Extending Flash |
|
|
|
| Introduction > Overview of the Adobe Flash JavaScript API > Running JSFL files | |||
There are several ways to run JSFL files. The most common ways are explained in this section.
To run a script that is in the Commands folder, do one of the following:
To run a command script that is not in the Commands folder, do one of the following:fl.runScript() command.
To add a tool implemented in a JSFL file to the Tools panel:You can add individual JavaScript API commands to ActionScript files by using the MMExecute() function, which is documented in the ActionScript 3.0 Language Reference. However, the MMExecute() function has an effect only when it is used in the context of a custom user-interface element, such as a component Property inspector, or a SWF panel within the authoring environment. Even if called from ActionScript, JavaScript API commands have no effect in Flash Player or outside the authoring environment.
To issue a command from an ActionScript script:
MMExecute(Javascript command string);
You can also run a script from the command line.
To run a script from the command line on Windows:"flash.exe" myTestFile.jsfl
To run a script from the "Terminal" application on the Macintosh:
osascript -e 'tell application "flash" to open alias "Mac OS X:Users:user:myTestFile.jsfl" '
The osascript command can also run AppleScript in a file. For example, you could put the following text in a file named myScript:
tell application "flash"
open alias "Mac OS X:Users:user:myTestFile.jsfl"
end tell
Then, to invoke the script, you would use this command:
osascript myScript
|
|
|
|