BIT-101 [2003-2017]

My three favorite JSFL commands


I’ve probably posted some of these before, but over the months, these three have proven worth their weight in gold, especially in developing components.

  1. Export Selected SWCs.jsfl

Select any components in your library (components you are developing) and run this command. They will be exported into your components directory. Also, if they are in a folder in the library, and a folder of the same name exists in your components directory, that’s where they’ll go. This could even be fixed up with the new file i/o api to create the directory if it doesn’t exist.

var _doc = fl.getDocumentDOM();
var _lib = _doc.library;
var items = _lib.getSelectedItems();
var numItems = items.length;
for(var i=0;i

2. No Export First Frame

This just goes through your library and unchecks "Export in First Frame" for every exported item. Again, quite useful in making components or preloaded applications.



items = fl.getDocumentDOM().library.items;
numItems = items.length;
for(var i=0;i

3. Save and Test.

Of course we all got used to Control-Enter to test, right? But then I got into PrimalScript, which allows you to run a script by hitting F7. I made this JSFL file for PrimalScript to cause it to save the current fla and test it. But then sometimes I'd do something in the Flash IDE and hit F7 out of habit and create a new keyframe or something stupid. So I copied the file over into my commands directory and assigned F7 as a keyboard shortcut to it. Note that it saves the file first, in case you do something that puts Flash into an infinite loop and crashes the program. At least your work is saved.



fl.outputPanel.clear();
fl.getDocumentDOM().save();
fl.getDocumentDOM().testMovie();

Note that you can assign keyboard shortcuts to ANY command. This really speed up workflow.
These are deceivingly small and simple, considering how useful they actually are. The first two, particularly.

« Previous Post
Next Post »