This sample shows how to use the ScriptUI FlashPlayer element to invoke JavaScript functions in ActionScript, and ActionsScript functions in JavaScript. It passes simple data between the two scripting environments, and displays passed values.
The Flash application to be used with this sample must be located in the resources
folder and have the same name as this sample. The application is a Flash presentation. The ActionScript script shows how to import the ExternalInterface class,
and how to register and call external functions, which are defined in this script.
The ActionScript source code is provided as a comment block in the
FlashDemo.JSX file.
Flash Player Security
Adobe ExtendScript supports the Flash Player client-runtime security model. This affects which SWF files
can be loaded into ESTK and run successfully. You must set the correct security permission
to allow the operation that the SWF file performs.
There are 3 basic levels of security for local SWF files:
For more information on local file security see:
http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/js/html/wwhelp.htm?href=00001136.html
http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/js/html/wwhelp.htm?href=00001604.html
To allow a local file to be trusted,(that is, allow a SWF file to access both network and local files as well as allow cross scripting), you can either create a trust file, or use the Settings Manager. This sample and the accompanying SWF file have been created with the default permissions; therefore to run the sample correctly, you must use one of these techniques, as described in the following sections.
SDKINSTALL\Resources\ActionScriptDemo.swf
Save this text file with the extension .cfg in a folder named 'FlashPlayerTrust' (which you may need to create), in one of the following locations, depending on the platform and users for which the SWF should be trusted.
Global Flash Player Trust Directory
C:\windows\system32\Macromed\Flash\FlashPlayerTrust
/Library/Application Support/Macromedia/FlashPlayerTrust
User Flash Player Trust Directory
C:\Documents and Settings\your-user-name\Application Data\Macromedia\Flash Player\#Security\FlashPlayerTrust
/Users/your-user-name/Library/Preferences/Macromedia/Flash Player/#Security/FlashPlayerTrust
For more information on the Settings Manager and Trust files see:
http://livedocs.macromedia.com/flex/2/docs/wwhelp/wwhimpl/js/html/wwhelp.htm?href=00001952.html
Public Member Functions | |
| void | ActionScriptDemo () |
| Boolean | run () |
| Functional part of this Snippet. | |
| Boolean | canRun () |
| Determines whether snippet can be run given current context. | |
Public Attributes | |
| File | flashFile |
| The Flash movie to load into ESTK. | |
| String | requiredContext |
| The context in which this snippet can run. | |
| void ActionScriptDemo::ActionScriptDemo | ( | ) |
| Boolean ActionScriptDemo::run | ( | ) |
Functional part of this Snippet.
Creates a Dialog window and adds a FlashPlayer control. A button on the dialog enables the activation of loading the flash player which extends the functionality with buttons that interact with the JavaScript functions; getJavaScriptString. getJavaScriptNumber and launchJavaScript. a flash movie.
| Boolean ActionScriptDemo::canRun | ( | ) |
Determines whether snippet can be run given current context.
The snippet fails if these preconditions are not met:
The Flash movie to load into ESTK.
The context in which this snippet can run.


Copyright© 2008 Adobe Systems Incorporated. All rights reserved.
Terms of Use Online Privacy Policy Adobe and accessibility Avoid software piracy Permissions and Trademarks