Reputation: 750
I need to collect and import a mass of images into Flash. The cleanest way to do this seems to be using AS3SWF to create a timeline with 1 image per frame.
Does anyone have a code sample for something like this? AS3SWF looks great, but it's not heavy on documentation.
Upvotes: 0
Views: 998
Reputation: 51867
I played with AS3SWF a bit some time ago and found the SWF format specs (pdf) and documentation very useful. Still I didn't find it particularly easy as I don't have proper programming background/assembly experience.
There might be an easier way around your problem: SWFTools.
They're a bunch of open source utilities, some of which might help you with your task, like jpg2swf
and png2swf
I'm currently on OSX, so have downloaded the source and used the typical commands:
sudo ./configure
sudo make
sudo make install
I see for Windows there's an exe already, so it might be simpler.
Still I imagine you'd call the utilities from command line.
That can come in handy when using the undocummented fl.runCommandLine()
function in JSFL.
Here's a basic call to compile a swf 'slideshow' based on all the .png files on my desktop:
./png2swf -o ~/Desktop/desk.swf ~/Desktop/*.png
There are quite a few options for each utility, here an example:
jpeg2swf
Usage: ./jpeg2swf [-options [value]] imagefiles[.jpg]|[.jpeg] [...]
-o , --output <outputfile> Explicitly specify output file. (otherwise, output.swf will be used)
-q , --quality <quality> Set compression quality (1-100, 1=worst, 100=best)
-r , --rate <framerate> Set movie framerate (frames per second)
-z , --zlib <zlib> Enable Flash 6 (MX) Zlib Compression
-M , --mx Use Flash MX H.263 compression (use for correlated images)
-x , --xoffset <offset> horizontally offset images by <offset>
-y , --yoffset <offset> vertically offset images by <offset>
-X , --width <width> Force movie width to <width> (default: autodetect)
-Y , --height <height> Force movie height to <height> (default: autodetect)
-T , --flashversion <version> Set flash file version to <version>
-v , --verbose <level> Set verbose level to <level> (0=quiet, 1=default, 2=debug)
-V , --version Print version information and exit
-f , --fit-to-movie Fit images to movie size
-e , --export <assetname> Make importable as asset with <assetname>
Also, it might be worth taking a peak at this old(2004) article by Keith Peters.
Upvotes: 3