AdobeBridgeCS5SDK

Class FlashDemo

Object
   |
   +--FlashDemo

class FlashDemo


Shows how to communicate with a ScriptUI FlashPlayer in Adobe Bridge using ActionScript

Usage

  1. Read the section on Flash Player Security below.
  2. Run the sample in the ExtendScript Toolkit (see Readme.txt), with Bridge CS5 as the target.
  3. The Flash-movie palette appears in the default top left corner of Bridge.
  4. On the first page of the Flash movie, click buttons to receive data from Bridge, which is displayed in the Flash Player.
  5. Click Next Page to show the second page. Click buttons to call JavaScript functions from the ActionScript environment and pass data as arguments to the functions.
  6. Click Next Page to show the third page. In the Bridge menu bar, choose items from the 'SDK FlashDemo' menu to invoke ActionScript functions that pass various data values to the Flash application, to be displayed in the Flash Player.
  7. Click Next Page to show the fourth page. Select a thumbnail in Bridge to send data about the Thumbnail state to the Flash application, which displays it in the Flash Player.
  8. Use the moving arrows to navigate between slides in the Flash Player.

Description

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 that has 4 slides. Each slide has a layer named 'Actions' which contains an ActionScript script. The ActionScript scripts show 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. The compiled code for the scripts is in .\resources\FlashDemo.fla

Flash Player Security

Adobe Bridge supports the Flash Player client-runtime security model. This affects which SWF files can be loaded into Bridge 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: To create a SWF file that can 'access the local file system only' or 'access the network only', edit the FLA file and do the following:
  • In Adobe Flash, select File > Publish Settings
  • In the dialog, select the Flash tab
  • Set the option for 'Local playback security' to either 'access network only' or 'access local files only'

    For more information on local file security see:

    http://livedocs.adobe.com/flex/3/html/05B_Security_03.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.

    Create a Trust File

    You can create a trust file in either the Global Flash Player Trust directory or in the User Flash Player Trust directory. A Trust file is a simple text file with a .cfg file extension, that contains the location to a local SWF file. For example, to run this sample as a trusted file on Windows, create a text file that contains the path and file name (replacing SDKINSTALL with your local SDK installation location):
    	SDKINSTALL\sdksamples\javascript\resources\FlashDemo.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

    User Flash Player Trust Directory

    Use the Settings Manager

    The Settings Manager allows you to make changes to various global settings, including whether to allow a SWF file to be trusted. When Bridge loads a non-trusted file that attempts a trusted action, the Flash Player presents a dialog giving the user the choice to navigate to the Settings Manager. Bridge can now play the Flash movie and data can be passed between the two scripting environments.

    For more information on the Settings Manager and Trust files see:

    http://livedocs.adobe.com/flex/3/html/05B_Security_03.html

    See:

    Defined in FlashDemo.jsx


    Field Summary
     File flashFile
              The Flash movie to load into Bridge
     String requiredContext
              The context in which this snippet can run.
     
    Constructor Summary
    FlashDemo()
               
     
    Method Summary
     Boolean canRun()
               Determines whether snippet can be run given current context.
     Boolean run()
               Functional part of this Snippet.

    Field Detail

    flashFile

    File flashFile

    requiredContext

    String requiredContext

    Constructor Detail

    FlashDemo

    FlashDemo()

    Method Detail

    canRun

    Boolean canRun()

    run

    Boolean run()

    AdobeBridgeCS5SDK

    http://www.adobe.com/devnet/bridge
    Documentation generated by JSDoc on Tue Apr 27 10:21:34 2010