Is it possible to publish a FLA from the command l

2019-02-02 00:31发布

问题:

In our project we have a large number (hundreds) of FLA files created by the artists in CS3, from which we compile SWFs to use in our Flex/AS3 application.

As part of a streamlined build/deploy system, it would be really handy to be able to automate publishing all these FLAs, and ideally deploying the SWFs too. I found some ways to do the batch publishing from CS3 using JSFL, but was surprised to discover CS3 doesn't apparently have any command-line functionality for this?

This is on a Linux system for what it's worth, I don't have experience with JSFL to know if you can run scripts from the command line somehow?

note: I should have said "Linux is preferred"... I don't use Linux but our server/build PC is Linux... I didn't realise CS3 was not compatible so I guess we can do this part on Windows.

回答1:

Execute your JSFL scripts from the command line just like this:

on Windows: "c:\program files\macromedia\flash 8\flash.exe" myscript.jsfl

on Mac: open myscript.jsfl

I believe older versions of Flash ran on Wine no problem but not as sure about CS3.

To iterate over a batch of local files, try something like this (in JSFL):

var importFolder = fl.browseForFolderURL('Select a folder with existing FLA files');
var importFolderContents = FLfile.listFolder(importFolder);
for (i = 0; i <importFolderContents.length; i++) {
    file = importFolderContents[i];
    fl.openDocument(file); // and so on
}

And some other methods you'll probably want to investigate are..

fl.getDocumentDOM() document.exportSWF() document.publish() fl.closeDocument()



回答2:

How you are running Flash CS3 on Linux ? you cannot run JSFL from command line but compiling a FLA file should be possible

some old example http://www.mikechambers.com/blog/2003/11/01/flashcommand-flash-2004-command-line-compiler/

newer stuff from Mike Chambers http://code.google.com/p/flashcommand/ for OSX

so it's definitely possible seems only through semi automated IDE publishing,

too bad Flex compiler is not capable of such a thing, together with ANT tasks it's a killer... with FDT editor things are pretty cool and automated



回答3:

Like it was already stated, it is possible to do with JSFL scripts, although you still need to have command line tool that communicates with Adobe Flash Professional to log the process into stdout and supply exit code based on compilation result.

I ended up writing this tool myself https://www.npmjs.com/package/flc. It is basically a command line interface that abstracts Adobe Flash Professional away. Tested against Flash Pro 2014 and 2015.



回答4:

Yes, absolutely. In fact, I've built an end-to-end solution which, at the click of a single button, will update class files with a version time stamp, open Flash if it's not already open, open individual files for publication, signal the automation program via inter-process-communication when each file has completed publishing so you don't run into any timing issues, and deploy specific files to the web upon completion (after automatically backing them up and timestamping the filenames), and the whole process completes in under 10 seconds.

See my Q&A here: Automating publishing of FLA files; calling Process.Start multiple times