views:

577

answers:

3

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.

+3  A: 

I'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.

Zárate
You're right - I want to call this as a pre-build step. I'll look into JSFL - thanks!
Simon
A: 

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!

Simon
Glad to hear you solved it :)
Zárate
A: 

lessen i do this may it's us full for you're too

var fileURL = fl.browseForFileURL("open", "Select file");

fl.openDocument(fileURL);

var documentDom = fl.getDocumentDOM();

documentDom.exportSWF("movie.swf",true);

documentDom.close(false);