MMExecute()

Availability

Flash Player 7.

Usage

MMExecute("Flash JavaScript API command;")

Parameters

Flash JavaScript API command Any command that you can use in a Flash JavaScript (JSFL) file.

Returns

The result, if any, sent by the JavaScript statement.

Description

Function; lets you issue Flash JavaScript API commands from ActionScript.

The Flash JavaScript API (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.

Example

The following command returns an array of objects in the library:

var libe:Array = MMExecute("fl.getDocumentDOM().library.items;");
trace(libe.length + " items in library");