Adobe Captivate-to-Flash ActionScript Communication

Read the journal entry introducing the LegacyCaptivateLoader.

Files

Instructions

Copy the proxy.swf file to the same folder as your main SWF.

Import the LegacyCaptivateController class into your AS3 file.

import pipwerks.LegacyCaptivateLoader;

Create a new LegacyCaptivateLoader instance. The constructor takes two parameters: the ID of the SWF being embedded into the HTML, and the URL of the Captivate SWF. The ID parameter MUST be accurate, and cannot contain hyphens.

var captivate = new LegacyCaptivateLoader("playerAS3", "sample-captivate-movie.swf");

If your Captivate uses a skin (including a border), set the usesSkin property to true. This property defaults to false, so if you don’t use a skin, you don’t need to declare it. If your file contains a skin and you don’t set usesSkin to true, the controls will not work.

captivate.usesSkin = true;

Since the LegacyCaptivateController is a sprite containing a Loader, you need to place the LegacyCaptivateLoader onto the stage using addChild(). This also means you can use ActionScript to position the LegacyCaptivateLoader wherever you like. (Note: The LegacyCaptivateLoader’s size automatically expands and contracts to match the dimensions of the imported Captivate SWF.)

addChild(captivate);
captivate.y = 25;
captivate.x = 25;

Control the Captivate SWF by using control(), passing the name of the ‘rdcmndXXX’ variable you’re interested in invoking:

captivate.control("rdcmndGotoFrame", 73);
captivate.control("rdcmndHidePlaybar");

Similarly, you can query the Captivate file using query(), passing the name of the ‘rdcmndXXX’ variable you’re interested in receiving:

var currentframe:Number = captivate.query("rdinfoCurrentFrame");
var slidecount:Number = captivate.query("rdinfoSlideCount");

If you’d like to unload the current Captivate and load a new one, just use the following syntax:

captivate.unloadSWF();  
captivate.usesSkin = false; //set this if needed
captivate.loadSWF("myothercaptivate.swf");

To unload the proxy, simply call

captivate.unloadProxy();

 

Methods and Properties

Available methods and properties Parameters Type Returns
LegacyCaptivateLoader() SWFID:String, CaptivateURL:String constructor None
usesSkin none Property (boolean, write only). none
control() rdcommand:String, framenumber:Number (optional) Method none
query() rdcommand:String Method Number
unloadSWF() none Method none
loadSWF() CaptivateURL:String Method none
unloadProxy() none Method none

New SCORM ebook coming soon!

I'm writing an ebook explaining how to build an HTML-based SCORM course. Subscribe to be notified when it's ready, as well as receive early bird pricing and some free goodies!

No spam, no sharing your email address, unsubscribe at any time. Powered by ConvertKit
Advertisements