Specifications

141
USING CAPTIVATE
Widgets
Last updated 9/28/2011
function cpSetValue(variable:String, val):void
{
if (variable == 'widgetMode')
{
widgetMode = val;
}
}
ExternalInterface.addCallback("cpSetValue", cpSetValue);
The way to get widgetParam has changed in ActionScript 3.0 because of changes in the structure of Captivate
demos:
var slide:Object = parent.parent.parent;
var slideXMl:XMLList = XMLList(slide.slideXMl);
var parname:String = parent.parent.name;
var ItemXML:XMLList = XMLList(slideXMl.ItemList.Item.(@name == parname));
widgetParam:String = ItemXML.widgetParams;
Understand the new way of parsing XML.
Note: Ensure that the version of ActionScript for the widget matches the ActionScript version used for the Captivate demo.
ActionScript 2.0 widgets do not work in movies published using ActionScript 3.0, and the other way around.
Accessing Adobe Captivate movie properties
MovieHandle
Adobe Captivate passes a handle to the widget during runtime using the cpSetValue function. The widget has to
implement something like the following inside its
cpSetValue function.
function cpSetValue( variable:String , val )
{
if(variable == 'movieHandle' ) {
this.movieHandle = val;
}
}
Methods and properties
Using MovieHandle, the following properties can be accessed.
widgetParams The widget parameter provided by the widget during edit time. In AS3 it is a function,
movieHandle.widgetParams(), and in AS2 it is a property, movieHandle.widgetParams.
replaceVariables(var:String) Any string with variable names enclosed in $$ is replaced with the value of the variable
at runtime. For example,
movieHandle.replaceVariables( $$JohnDoe$$ scored
$$cpQuizInfoPointsscored$$ out of $$cpQuizInfoTotalQuizPoints$$) returns "JohnDoe scored 10 out of
100" assuming that JohnDoe scored 10 points out of the total 100 that was set in Adobe Captivate.
getContainerProps() Return the properties of the container.
containerType Returns one of the following: Slide, Slidelet, Zoom Destination Slide, Zoom Destination Slidelet,
Movie (in case of rest of project widget)