I needed to stitch a stack of PNG images into a SWF using a server process. There are quite a few tools and methods for doing this interactively, but it gets painful if you want an unattended process.
I found SWFTools (includes PNG2SWF.EXE), which handles the awful, complex bit of … building a SWF from a bunch of PNGs, but then I needed to figure out how to get it to auto-magically use all the PNGs in a specific folder. Essentially, I found a tool that does the hard part, but I needed to cobble together the actual command it should use. Wince if you want to, but I’m a masochist and I hacked together this batch file (like it’s 1988, baby):
REM Build a list of PNGs
for /f "delims=" %%a in ('dir /b /a-d %1*.png 2^>NUL') do call :process %%a %1
REM now make a SWF!
CALL png2swf -r 20 -o %2 %LIST%
REM append the next file to the LIST variable
if not "%LIST%"=="" set LIST=%LIST%
example usage — test.bat c:\path\pngFolder c:\path\resulting.swf
I’m sure this is dead easy in linux (you can get swftools in linux flavors too, including source), and I’ll send cookies to whoever posts the first working script in the comments.
Note: I’m not sure why this is, but the resulting SWF can’t be imported into Flash CS3 as one would expect. If you were going to do that, you could’ve imported the initial sequence in the first place.