Specifications
143
USING CAPTIVATE
Widgets
Last updated 9/28/2011
var slideProps:Object;
var movieHandle:Object;
function cpSetValue( variable:String , val ) {
if ( variable == 'movieHandle' ) {
movieHandle = val;
}
}
function onWidgetEnabled(){
slideProps = movieHandle.GetSlideProps();
}
function myWidgetFunction (){
if(slideProps.slideType == "Question Slide" ) {
myLabel.Text = "" ;
}
}
Ensure that operations are carried out during Adobe Captivate runtime only when the widget is enabled. Operations
on
movieHandle (particularly variablesHandle) when the widget is not enabled might lead to unexpected results.
Question widgets
Question widgets should implement the following functions in addition to the functions discussed in this topic.
getWidgetQuestionState() This method is called when the user clicks Submit on the question slide. The method
provides the widget with an option to restore its state when the quiz is restored in an LMS. This function should return
a non-empty string in a way that it can restore its state when the widget is reloaded.
setWidgetQuestionState() Restores the widget to its previous state. setWidgetQuestionState() is called when the
widget is reloaded in the LMS.
function getWidgetQuestionState()
{
trace("get Widget Question State");
return "<var1>"+var1+"</var1><var2>"+var2+"</var2>"
//Should be a non- empty String.Should not contain _ and ;
}
function setWidgetQuestionState( val:String)
{
trace("set Widget Question State()" + val );
}
For example, let us consider that the state of the variables is var1=10, var2="Captivate" when Submit is pressed and the
function is called. Open the Adobe Captivate quiz in LMS, attempt the question, and press Submit. The
getWidgetQuestionState function is called. Re-open the quiz in LMS. When the widget question is shown, function
setWidgetQuestion is called with the same string: "<var1>10</var1><var2>Captivate</var2>"
answers() Displays the review feedback. The function returns an array of Objects() with the following properties.
• answerID A unique ID for every answer.
• chosenAnswer String representing the answer chosen by the learner.
• correctAnswer String representing the correct answer.
For example,