JSFL to the rescue!
15 09 2003You’ve probably all read about the great new extensibility features in Flash MX 2004. We’ve got Timeline effects, Tools, Behaviours but my personal favourite is - believe it or not - Commands.
Commands are basically little (or not so little) scripts written in JSFL that perform a sequence of task in the authoring environment. You can choose to code your commands by hand and drop them in the “Commands” folder or simply select the steps you want to reproduce from the History Panel and save those to a Command. Once you’ve done that your script is available from the Commands menu of the toolbar and can be run
It’s that easy, I bet even your grandmother could do it! I can’t tell you how things like that can influence your workflow.
I’ll share with you the very first command I created “prepareLayers.jsfl. What it does is add two layers to the timeline, one for actionscript one for frame labels and lock them. This is something I would typically do every time I created a new FLA.
I became quite proficient at doing so, it would usually take me just under 10 seconds to add these layers, change the layer name and lock them. Now I’m down to 3 seconds, Commands > prepareLayers … talk about increased performance! ![]()





Hey Peter, congrats on your new blog :D! I was confused for a minute as to know whether the comments link was above or below the posts though :p.
Anyway, Thanks for sharing this file. This is also typically what I do and probably most Flash developers too. I wish there were more info about JFSL available. Any insights on coming up documentation?
Hi Peter,
Good to see you blogging! The JSFL file you’ve got can be slimmed down some…
// Get reference to current timeline
var cur_tl = fl.getDocumentDOM().getTimeline();
// Add Labels layer and lock
cur_tl.addNewLayer(”Labels”);
cur_tl.setLayerProperty(”locked”, true);
// Add Actions layer and lock
cur_tl.addNewLayer(”Actions”);
cur_tl.setLayerProperty(”locked”, true);
Steve
Thanks for that Steve, you’re absolutely right about the JSFL, this one got saved straight from the History Panel.
It’s certainly good practice to go in and remove all redundant code when you save something from the History Panel, especially when dealing with more complicated commands.