New JSAPI added to Flash CS4 Professional in 10.0.2 Update

A new JSAPI that allows for silent publishing of FLA files without opening them in the Flash IDE has been added to Flash Professional CS4 in the 10.0.2 updater. This API replaces functionality that went away when the old CS3 Project panel was replaced with the new CS4 Project panel.

Here are the details. This info will be added to the online version of Extending Flash soon.

Usage
fl.publishDocument( flaURI [, publishProfile] );

Parameters
flaURI — A string, expressed as a file:/// URI, that specifies the path of the FLA file that should be silently published.

publishProfile — A string that specifies the publish profile to use when publishing. If this parameter is omitted, the default publish profile is used.

Returns
boolean

Description
Method; publishes a FLA file without opening it. This API opens the FLA in a headless mode and publishes the SWF (or whatever the profile is set to). The second parameter (publishProfile) is optional. The return value is a boolean indicating if the profile was found or not. In the case where the second parameter is not supplied, the return value is always true.

Example
The following example prompts the user to select a FLA file and silently publishes it using the “Default” publish profile:

var uri = fl.browseForFileURL(“select”, “select a FLA file to publish”);
var publishProfileName = “Default”;
fl.publishDocument(uri, publishProfileName);