Flash generation is such a hotly-contested topic that I really had second thoughts about running the second part of this series! While the incredible creativity offered by Flash movies is all very well, many users are totally put off sites that insist on Flash content - sometimes due to its seemingly spurious animation possibilities, but often also due to its need for a browser plug-in which many don't have.
A lot of development work has been done by the Unix community to make a free-for-all version of a Flash generation library, and PHP has support for two Flash libraries: libswf, and Ming. libswf is fairly old, closed-source, and is not developed any more, so generally people tend to skip by it. Ming, however, is LGPL, object-oriented, and actively maintained. If you are too young to remember "Flash Gordon", you may miss the Ming naming humour!
For the purpose of this article, we will be using the Ming extension to PHP. If you don't have it installed and want to try out code examples as you read, go ahead and read the box-out "Installing Ming".
Before you begin, note that very often you need to tweak objects in your movie to get them to work just as you want them to. I have found in the past that a movie which looks perfect in Mozilla on Linux looks slightly off in IE on a Mac causing me to have to make minor changes to bring them into line.
Also, it is important to note that all values specifying some form of distance, length, height, or size are in twips, which is twenty units per pixel. Flash movies scale to fit their container, though, so these measurements are entirely arbitrary figures.
If this was helpful, please take a moment to tell others about Hacking with PHP by tweeting about it!
Next chapter: A simple movie >>
Previous chapter: PDF without a module?
Home: Table of Contents
Copyright ©2015 Paul Hudson. Follow me: @twostraws.