Note: The following content is over a decade old and should be considered deprecated. I have left it up for historical purposes.

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;Code language: JavaScript (javascript)

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");Code language: JavaScript (javascript)

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;Code language: JavaScript (javascript)

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");Code language: JavaScript (javascript)

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");Code language: JavaScript (javascript)

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");Code language: JavaScript (javascript)

To unload the proxy, simply call

captivate.unloadProxy();Code language: CSS (css)

Methods and Properties

Available methods and propertiesParametersTypeReturns
LegacyCaptivateLoader()SWFID:String, CaptivateURL:StringconstructorNone
usesSkinnoneProperty (boolean, write only).none
control()rdcommand:String, framenumber:Number (optional)Methodnone
query()rdcommand:StringMethodNumber
unloadSWF()noneMethodnone
loadSWF()CaptivateURL:StringMethodnone
unloadProxy()noneMethodnone