Is there a way to call an external script or program from Flash CS3 every time it builds a SWF file? I'd like to add subversion information using subwcrev - the SVN keywords don't work because they only update when the version class file is updated.
views:
577answers:
3I'm not sure what are JSFL capabilities these days, but I'd say inside Flash IDE is your only bet. JSFL is a language to extend the Flash IDE, but I'm not sure you can do this.
On a related note, adding SVN information to your SWFs is not trivial. You'd probably need SVN hooks to put the information before actually compiling the SWF itself.
I doubt you can do this compiling with Flash IDE but I'd be more than happy to hear otherwise.
With thanks to Zárate, it looks like JSFL is the answer, or at least part of it. I can't get flash to run external scripts, but I can get external scripts to run flash; so I have two scripts now; build.bat and build.jsfl
build.bat:
subwcrev . Version.svn.as Version.as
IF ERRORLEVEL 1 EXIT /B $ErrLev
flash.exe ./build.jsfl
IF ERRORLEVEL 1 EXIT /B $ErrLev
build.jsfl:
fl.openDocument("file:///movie.fla");
var documentDom = fl.getDocumentDOM();
documentDom.exportSWF("file:///movie.swf",true);
documentDom.close(false);
FLfile.remove("file:///Version.as");
I've added build.bat to my project; if I double-click on build.bat, the project builds the SWF movie with the SVN version info. That works from within the Flash IDE or from the file explorer. If I forget, and click on 'test project', then the build fails because it can't find Version.as.
Thanks again, Zárate!