MMExecute()
553
MMExecute()
Availability
Flash Player 7.
Usage
MMExecute("
Flash JavaScript API command
;"
:String
)
Parameters
Flash JavaScript API command
Any command that you can use in a Flash JavaScript
(JSFL) file.
Returns
A string representation of the result, if any, sent by the JavaScript statement.
Description
Function; lets you issue Flash JavaScript API (JSAPI) commands from ActionScript.
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
.
Example
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.
•
Place the following code into frame 1 of the main Timeline of an empty Flash document:
var numLibItems = MMExecute("fl.getDocumentDOM().library.items.length");
var message = numLi " items in library";
MMExecute('fl.trace("' + m '");');
•
Save the FLA file in the WindowSWF directory that is located in your Configuration directory,
and then select File > Publish (or save it elsewhere and either publish the SWF file directly to
that directory, or move the SWF file to that directory).
•
Quit and restart the application (you need to do this step the first time you add your file to the
WindowSWF directory).
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.
CHAPTER 7
ActionScript for Flash
Summary of Contents for FLEX
Page 1: ...Flex ActionScript Language Reference ...
Page 8: ......
Page 66: ...66 Chapter 2 Creating Custom Classes with ActionScript 2 0 ...
Page 76: ......
Page 133: ...break 133 See also for for in do while while switch case continue throw try catch finally ...
Page 135: ...case 135 See also break default strict equality switch ...
Page 146: ...146 Chapter 5 ActionScript Core Language Elements See also break continue while ...
Page 808: ...808 Chapter 7 ActionScript for Flash ...
Page 810: ...810 Appendix A Deprecated Flash 4 operators ...
Page 815: ...Other keys 815 Num Lock 144 186 187 _ 189 191 192 219 220 221 222 Key Key code ...
Page 816: ...816 Appendix B Keyboard Keys and Key Code Values ...
Page 822: ...822 Index ...