I recently used JSFL to make a Flash IDE pop-up (modal) interface for changing settings in the library, stage, and actionscript for a selected movieclip or button. In order to make your own, there are a few (complicated) steps to take. The same pattern works for CS3 and CS4 on Windows. The directory structure is in a different location on XP versus Vista, but this method works the same.

(Note: these steps are generic and an overview. They will not work if you just cut-and-paste. This is only meant as a guide for the parts that caused me some consternation).

JSFL IDE extensions are a 4-step process:

1. Develop a very generic SWF interface in Flash IDE. Publish it to Adobe Flash’s user directory. I put it in the “WindowsSWF” dir:

C:\Users\[your username]\AppData\Local\Adobe\Flash CS4\en\Configuration\WindowSWF

2. In JSFL, call XUL (XML for SWF) for setting up on-screen components (you could do much of this in SWF, but I think XUL programming is actually easier).

fl.documents[0].xmlPanel( [XML command dir + filename] );

3. in XML, call JSFL functions to manage components in the XUL/interface (this format of XML is called an XUL) as well as the affected FLA document.


<?xml version="1.0"?>
<dialog title="Sample XML" >
<button label="Run command and Close." tabindex="0" oncommand="onCloseAccept();" />
<script>
function onCloseAccept()
{
    // any javascript functions can be called here, but you cannot use currently loaded JSFL variables/functions due to scoping rules:
    fl.runScript( fl.configURI + 'Commands\/someJSFLFile.jsfl', 'someFunctionInTheJSFLFile' );
    // close the pop-up
    fl.xmlui.accept();
}
</script>
</dialog>

4. Call your developed JSFL within some AS of a SWF:

runMMExecute([directory + XML filename], [function to run], [function parameters]);
function runMMExecute(... args):String
{
// MMExecute ONLY works in a component environ, and cannot be "debugged" the normal way in Flash:
var str:String = 'fl.runScript("' + args.join('","') + '");';
var ret:String = parent.runMMExecute(str);
}

For debugging, add an extra label or textfield in the SWF or XML and dump messages to that field. Also, you have to be somewhat careful in JSFL to call the correct FLA document. It’s not difficult, but code can break if you have multiple FLA files open, so you just need to be aware of it at the start (i.e., document[0] is not always the expected doc).

The best reference (at this point) for anything JSFL is from Adobe:
http://livedocs.adobe.com/flash/9.0/main/flash_cs3_extending.pdf
http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/js/html/wwhelp.htm?href=Part7_Extending_Flash_1.html