Lab: Adobe Captivate:
Adobe Captivate-to-Flash ActionScript Communication
Background: What seems to be the problem?
Captivate has no ActionScript feature!
- Captivate is meant to be an easy tool for non-programmers to use, and therefore does not include scripting capability.
- This bucks the trend established by Director, Authorware and Flash.
- Generated SWFs are built with ActionScript, but Captivate provides no method for tapping into a SWF’s ActionScript functionality.
- SWFs can make JavaScript calls, but only in limited circumstances.
- Captivate 3 offers no advances in custom scripting functionality over Captivate 2.
- We must continue to make do with workarounds (for now?).
What are some possible uses for Captivate-to-Flash communication?
- Letting the Captivate SWF unload itself from Flash container at a specific time.
- Telling the Flash container to load a different SWF (useful for branching scenarios that extend beyond a single SWF).
- Instructing the Flash container to perform some kind of action at specified points in the Captivate SWF. Examples: A course progress meter; color or graphical changes in the player SWF based on actions taken in the Captivate SWF (such as a hot/cold meter); pop-up messages; timer displays; a custom scoreboard for completing certain activities; logging/tracking user choices in a branching scenario; etc.
How do we overcome these limitations?
With workarounds, of course! There are two significant workarounds that can be used to enable Captivate SWFs to send ActionScript calls to Flash SWFs.
- Workaround 1: Flash SWFs can be imported into a Captivate file and used to send ActionScript calls to a Flash player/container SWF
- Workaround 2: Flash’s ExternalInterface class can be used receive JavaScript calls from Captivate and convert them into ActionScript calls that get sent to a Flash player/container SWF.
Important note: All communication is ONE-WAY from Captivate to Flash. These workarounds do not enable Captivate to receive custom ActionScript calls.
When is the best time to use a particular method?
| Situation | Imported SWF workaround | ExternalInterface workaround |
|---|---|---|
| When supporting Flash Player 7 | X | |
| When supporting Flash Player 8 or greater | X | X |
| When using custom Flash-based "player" SWF to load external Captivate-based SWFs | X | X |
| When very few ActionScript calls are needed from Captivate | X | |
| When many ActionScript calls are needed from Captivate, especially if they are frequently edited | X | |
| When the ActionScript call needs to be invoked mid-slide or without being attached to a user event, such as a button click | X | |
| If the ActionScript is only invoked at the completion of the Captivate SWF | X | X |
| When user action in Captivate (such as clicking button) requires Captivate event such as "jump to slide" or "continue" | X | |
| When custom ActionScript calls also need to work with HTML page's JavaScript | X |
First things first: Get the files
Before we can get into our Captivate-to-Flash communication workarounds, we need to create a Captivate file, a Flash "player" file (referred to from here on as "player" or "player SWF"), and an HTML file to hold the player SWF; the HTML file loads the player SWF, which in turn loads the Captivate SWF.
To save time, I’ve already created these files. You can download them here (ZIP format).
Go to Captivate main page | Continue to next section: Workaround 1