Flash 8 Documentation |
|||
| ActionScript 2.0 Language Reference > ActionScript language elements > Global Functions > MMExecute function | |||
MMExecute("Flash JavaScript API command;":String) : String
Lets you issue Flash JavaScript API (JSAPI) commands from ActionScript. In Flash MX2004 the MMExecute function can be called only by a movie that is used as a Flash Panel (file is stored in WindowSWF directory), by an XMLtoUI dialog box, or by the Custom UI of a component. JSAPI commands have no effect in the player, in test movie mode, or outside the authoring environment.
The Flash JSAPI provides several objects, methods, and properties to duplicate or emulate commands that a user can enter in the authoring environment. Using the JSAPI, you can write scripts that extend Flash in several ways: adding commands to menus, manipulating objects on the Stage, repeating sequences of commands, and so on.
In general, a user runs a JSAPI script by selecting Commands > Run Command. However, you can use this function in an ActionScript script to call a JSAPI command directly. If you use MMExecute() in a script on Frame 1 of your file, the command executes when the SWF file is loaded.
For more information on the JSAPI, see www.macromedia.com/go/jsapi_info_en.
Availability: ActionScript 1.0; Flash Player 7
command:String - Any command that you can use in a Flash JavaScript (JSFL) file.
String - A string representation of the result, if any, sent by the JavaScript statement.
The following command will output the number of items in the library of the current document to the trace window. You must run this example as a Flash panel because Flash files can't call MMExecute if they are run in either test movie or the browser.
var numLibItems = MMExecute("fl.getDocumentDOM().library.items.length");
var message = numLibItems + " items in library";
MMExecute('fl.trace("' + message + '");');Now you can select your file from the bottom of the Window > Other Panels menu.
The ActionScript trace function does not work from a Flash panel; this example uses the JavaScript fl.trace version to get the output. It might be easier to copy the results of MMExecute to a text field that is part of your Flash Panel file.
Version 8
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/8/main/00001747.html
Comments
Michael Gioffredi said on Nov 27, 2005 at 3:57 PM :