| Package | widgetfactory |
| Class | public class QuestionWidget |
| Inheritance | QuestionWidget StaticWidget flash.display.MovieClip |
Question Widgets behave quite differently in Captivate than Static and Interactive Widgets. For example, when you insert a Static or Interactive Widget into Captivate, they are added as an object of the slide you are currently on. Whereas, when you insert a Question Widget, Captivate creates a new slide, with the question widget being treated as part of the slide.
In Captivate 4, the Widget Properties are located in Edit Question...
...under the main Question tab.
In Captivate 5, you access the Widget Properties in the same place as Static and Interactive Widgets. By selecting the widget, and going to the Properties panel > Animation Accordion > Widget Properties button.
With QuestionWidget comes the addition of QuestionWidgetEvent,
which provides many new events specifically for use with quizzing.
Just like when creating a StaticWidget or an InteractiveWidget, to write a QuestionWidget
you must create a class and have it extend the QuestionWidget class.
package {
import widgetfactory.QuestionWidget;
public class YourClassName extends QuestionWidget {
public function YourClassName () {
}
}
}
See also
| Property | Defined By | ||
|---|---|---|---|
| backButton : MovieClip
The Back button for the QuestionWidget. | QuestionWidget | ||
![]() | captivateMainTimeline : MovieClip [read-only]
Same as cpVariables, but under more correct name. | StaticWidget | |
| clearButton : MovieClip
The Clear button for the QuestionWidget. | QuestionWidget | ||
![]() | cpVariables : MovieClip
Holds Captivate System variables, and user-defined Captivate Variables created by the Author. | StaticWidget | |
![]() | currentSlide : MovieClip [read-only]
Gives access to the slide currently being viewed in the Captivate Movie. | StaticWidget | |
![]() | currentWidgetMode : String [read-only]
Holds a string name of the current Widget Mode. | StaticWidget | |
![]() | dispatchRuntimeAfterRewind : Boolean
Sets whether or not WidgetEvent.ENTER_RUNTIME and enterRuntime() are called when the Captivate movie is rewound and viewed again. | StaticWidget | |
![]() | eventDispatcher : IEventDispatcher
The default dispatcher of the com.adobe.captivate.events in Captivate 5. | StaticWidget | |
![]() | isCaptivate4 : Boolean [read-only]
Returns true if the widget is being used by Captivate 4. | StaticWidget | |
![]() | isCaptivate4Embedded : Boolean [read-only]
Returns true if the widget is in Captivate 4 and embedded in the movie. | StaticWidget | |
![]() | isCaptivate5 : Boolean [read-only]
Returns true if the widget is being used by Captivate 5. | StaticWidget | |
| isCompleteAnswer : Boolean
Determines if Captivate sees the question as complete (true) or incomplete (false). | QuestionWidget | ||
| isCorrectAnswer : Boolean
Determines if Captivate marks the question as correct (true) or incorrect (false). | QuestionWidget | ||
![]() | isFirstRuntime : Boolean [read-only]
Indicates whether this is the first time runtime has been dispatched for this widget. | StaticWidget | |
![]() | isInAggregator : Boolean [read-only]
Indicates whether the Captivate Movie is inside an aggregator. | StaticWidget | |
![]() | isInRuntime : Boolean [read-only]
Indicates whether the movie's current position is within the widget's set period to be active. | StaticWidget | |
![]() | isReadyForStageSnapShot : Boolean
Tells Captivate if the widget is prepared to have the Stage snapshot taken. | StaticWidget | |
![]() | itemName : String [read-only]
Hold the item name that the Captivate Author gave the widget. | StaticWidget | |
![]() | movieVariables : Object
Allows you to control, and get information from, Captivate. | StaticWidget | |
![]() | properties : Object
Stores settings given by the Captivate Author in the Properties Dialog interface. | StaticWidget | |
![]() | propertiesDialogHeight : int
Sets the height of the Properties Dialog in Captivate 5. | StaticWidget | |
![]() | propertiesDialogWidth : int
Sets the width of the Properties Dialog in Captivate 5. | StaticWidget | |
| questionState : String
Holds a string that is sent to the Learning Management System (LMS) when the question is submitted. | QuestionWidget | ||
| questionText : MovieClip
The container of the Question Text field for the QuestionWidget. | QuestionWidget | ||
| questionTitle : MovieClip
The container of the Question Title text field for the QuestionWidget. | QuestionWidget | ||
| quizReporter : QuizReporterProxy [read-only]
The Quiz Reporter object that is associated with this quiz question. | QuestionWidget | ||
| reportScore : int
The score that will be reported to the quiz (assuming the question reports as correct). | QuestionWidget | ||
| skipButton : MovieClip
The Skip button for the QuestionWidget. | QuestionWidget | ||
| submitButton : MovieClip
The Submit button for the QuestionWidget. | QuestionWidget | ||
![]() | widgetInfo : WidgetInfo [read-only]
Holds information about how the Captivate Author set up the widget. | StaticWidget | |
![]() | widgetSlide : MovieClip
The slide to which the Widget was added by the Captivate Author. | StaticWidget | |
| Method | Defined By | ||
|---|---|---|---|
QuestionWidget(propertiesDialogWidth:Number, propertiesDialogHeight:Number, propertiesObject:ICaptivateWidgetData = null)
Creates a new instance of the QuestionWidget class. | QuestionWidget | ||
Adds an answer to the Answer list. | QuestionWidget | ||
clearAnswerList():void
Clears the Answer List of all Answers. | QuestionWidget | ||
clearAnswers():void
A Template Method that is called when this question's 'Clear' button is pressed. | QuestionWidget | ||
disableAnswers():void
A Template Method that is called when the question's interactivity should be turned off. | QuestionWidget | ||
![]() | drawPropertiesDialogBackground(useStageGraphics:Boolean = true):void
Makes the Widget's background colour consistent with the Properties Dialog boarder in Captivate 5. | StaticWidget | |
enableAnswers():void
A Template Method that is called when the question's interactivity should be turned on. | QuestionWidget | ||
![]() | getSlide(slide:*):MovieClip
Returns a reference to the slide with the number or label you pass in. | StaticWidget | |
![]() | getSlideObjectByName(slideObject:String, slide:* = -1):*
Returns a reference to any object on a Captivate slide that matches the name you passed in. | StaticWidget | |
![]() | gotoSlide(slide:*):void
Jumps to the slide with the number or label you pass in. | StaticWidget | |
setQuestionState(questionState:String):void
A Template Method called when the LMS returns the questionState string. | QuestionWidget | ||
triggerSubmitProcess():void
Tells Captivate to start the Question Widget's submit process. | QuestionWidget | ||
![]() | updateRuntimeStatus(hasEnteredRuntime:Boolean):void | StaticWidget | |
| Method | Defined By | ||
|---|---|---|---|
compareAnswers(answerID:String, chosenAnswer:String, correctAnswer:String):void
A Template Method that is called when the user reviews the quiz and reaches this Question Widget. | QuestionWidget | ||
![]() | disablePropertiesDialog():void
Turns off the Properties Dialog in Captivate 5. | StaticWidget | |
![]() | enterMovie():void
A Template Method that is called when the Captivate Movie begins. | StaticWidget | |
![]() | enterPropertiesDialog():void
A Template Method that is called when the Properties Dialog (Widget Parameters tab in Captivate 4) is opened. | StaticWidget | |
![]() | enterPropertiesDialogPreview():void
A Template Method that is called when Captivate 4 displays your widget in the preview area of the Properties Dialog Widget tab. | StaticWidget | |
![]() | enterRuntime():void
A Template Method that is called when the Captivate Movie enters the period in which this widget is supposed to appear. | StaticWidget | |
![]() | enterStage():void
A Template Method that is called when your widget is displayed on the Captivate stage. | StaticWidget | |
![]() | enterWidgetPanelPreview():void
A Template Method that is called when your widget is being previewed in the Widget Panel. | StaticWidget | |
![]() | exitRuntime():void
A Template Method that is called when the Captivate Movie leaves the period of time in which the widget is supposed to appear. | StaticWidget | |
![]() | saveProperties():void
A Template Method that is called when the OK button inside the Properties Dialog is clicked. | StaticWidget | |
submit():void
A Template Method that is called when the 'Submit' button is pressed. | QuestionWidget | ||
![]() | translatePropertiesXML():void
Converts the properties XML into a formatted object. | StaticWidget | |
| Event | Summary | Defined By | ||
|---|---|---|---|---|
| Dispatched when this question's 'Clear' button is pressed. | QuestionWidget | |||
| Dispatched when the user reviews the quiz and reaches this Question Widget. | QuestionWidget | |||
| Dispatched when your interactivity should be turned off. | QuestionWidget | |||
| Dispatched when your interactivity should be turned on. | QuestionWidget | |||
![]() | Dispatched when the Captivate Movie begins. | StaticWidget | ||
![]() | Dispatched when the Properties Dialog (Widget Parameters tab in Captivate 4) is opened. | StaticWidget | ||
![]() | Dispatched when Captivate 4 displays your widget in the preview area of the Properties Dialog Widget tab. | StaticWidget | ||
![]() | Dispatched when the Captivate Movie enters the period in which this widget is supposed to appear. | StaticWidget | ||
![]() | Dispatched when the Captivate movie progresses into a new slide (except for the very first slide of the movie). | StaticWidget | ||
![]() | Dispatched when Captivate displays your widget on the stage. | StaticWidget | ||
![]() | Dispatched when your widget is being previewed in the Widget Panel. | StaticWidget | ||
![]() | Dispatched when the Captivate Movie leaves the period of time in which the widget is supposed to appear. | StaticWidget | ||
![]() | Dispatched when the Captivate movie has reached the last frame of the current slide, and is about to move on to the next slide. | StaticWidget | ||
![]() | Dispatched whenever an interactive object sends information back to Captivate. | StaticWidget | ||
![]() | Dispatched when the published Captivate movie reaches its last frame. | StaticWidget | ||
![]() | Dispatched whenever the Captivate movie is paused. | StaticWidget | ||
![]() | Dispatched if the Widget Properties do not load correctly. | StaticWidget | ||
| Dispatched when any native Captivate question type or Question Widget is submitted. | QuestionWidget | |||
![]() | Dispatched when the movie resumes after being paused. | StaticWidget | ||
![]() | Dispatched when the OK button inside the Properties Dialog is clicked. | StaticWidget | ||
| Dispatched when the LMS returns the questionState string. | QuestionWidget | |||
| Dispatched when the 'Submit' button is pressed. | QuestionWidget | |||
| backButton | property |
backButton:MovieClip
The Back button for the QuestionWidget.

public function get backButton():MovieClip public function set backButton(value:MovieClip):voidSee also
| clearButton | property |
clearButton:MovieClip
The Clear button for the QuestionWidget.

public function get clearButton():MovieClip public function set clearButton(value:MovieClip):voidSee also
| isCompleteAnswer | property |
isCompleteAnswer:BooleanDetermines if Captivate sees the question as complete (true) or incomplete (false). If Captivate picks up that the question is incomplete, it will not accept the question as correct or incorrect, and will show the 'You must answer the question' callout.

The audience is then given another opportunity to answer the question.
It is best to set the value of this property in the submit() Template Method, or during the QuestionWidgetEvent.SUBMIT event.
The default value is true.
public function get isCompleteAnswer():Boolean public function set isCompleteAnswer(value:Boolean):voidSee also
| isCorrectAnswer | property |
isCorrectAnswer:Boolean
Determines if Captivate marks the question as correct (true) or incorrect (false).
Captivate will first look to see if isCompleteAnswer equals true.
If so, then it will check isCorrectAnswer.
If not, then Captivate will skip over isCorrectAnswer
and give the audience another chance to answer the question.
When isCorrectAnswer is returned as true,
Captivate marks the question as correct, and displays the success caption.

When isCorrectAnswer is returned as false,
Captivate marks the question as incorrect, and displays the failure caption.

Depending on how the Captivate Author has set up the question, the audience may be allowed another chance at answering the question after submitting a wrong answer.

Once the question has been answered correctly, or the last failure level reached,
the QuestionWidgetEvent.DISABLE_ANSWERS event and disableAnswers() Template Method are fired,
and the movie moves on to the next question.
The default value is false.
public function get isCorrectAnswer():Boolean public function set isCorrectAnswer(value:Boolean):voidSee also
| questionState | property |
questionState:StringHolds a string that is sent to the Learning Management System (LMS) when the question is submitted. The LMS will return the string to the widget if the user revisits the lesson later to pick up where they left off.
When the user opens up the course again, the widget will have to reload, but will have no memory of how it was set up when the user left it.
The widget developer must include enough information in the questionState string to enable the Question Widget to be configured exactly as it appeared when it was submitted by the user.
Additionally, the developer must code the widget so when it receives this information, when the QuestionWidgetEvent.QUESTION_STATE_SET is dispatched, it will know what to do with it.
public function get questionState():String public function set questionState(value:String):voidSee also
A good way to store information in the questionState string, is to write the data you need as XML.
Then set the questionState equal to the XML object.
When the QuestionWidgetEvent.QUESTION_STATE_SET event or setQuestionState Template Method are fired,
you know that the LMS has returned the questionState.
You can then format that string back into an XML object. Like so:
var xml:XML = new XML(<questionState/>);
xml.textField = "Hello";
xml.selectedAnswer = "Answer1";
questionState = xml;
addEventListener(QuestionWidgetEvent.QUESTION_STATE_SET, questionStateReturn);
function questionStateReturn (event:QuestionWidgetEvent):void {
var questionStateXML:XML = new XML(questionState); // Turns the string into XML data
onstage_txt.text = questionStateXML.textField; // The on stage text field will read the value of the 'textField' property we wrote on the XML object.
}
| questionText | property |
questionText:MovieClip
The container of the Question Text field for the QuestionWidget.
public function get questionText():MovieClip public function set questionText(value:MovieClip):voidSee also
| questionTitle | property |
questionTitle:MovieClip
The container of the Question Title text field for the QuestionWidget.
public function get questionTitle():MovieClip public function set questionTitle(value:MovieClip):voidSee also
| quizReporter | property |
quizReporter:QuizReporterProxy [read-only]
The Quiz Reporter object that is associated with this quiz question.
For more information see the QuizReporterProxy class.
public function get quizReporter():QuizReporterProxySee also
| reportScore | property |
reportScore:intThe score that will be reported to the quiz (assuming the question reports as correct).
This can be altered to give a partial score which is different to the one the Captivate Author set up under the Quiz Properties panel > General Settings > Points.
public function get reportScore():int public function set reportScore(value:int):void| skipButton | property |
skipButton:MovieClip
The Skip button for the QuestionWidget.

public function get skipButton():MovieClip public function set skipButton(value:MovieClip):voidSee also
| submitButton | property |
submitButton:MovieClip
The Submit button for the QuestionWidget.

public function get submitButton():MovieClip public function set submitButton(value:MovieClip):voidSee also
| QuestionWidget | () | Constructor |
public function QuestionWidget(propertiesDialogWidth:Number, propertiesDialogHeight:Number, propertiesObject:ICaptivateWidgetData = null)Creates a new instance of the QuestionWidget class.
ParameterspropertiesDialogWidth:Number (default = NaN) — Defines the width of the Properties Dialog in Captivate 5.
| |
propertiesDialogHeight:Number (default = NaN) — Defines the height of the Properties Dialog in Captivate 5.
| |
propertiesObject:ICaptivateWidgetData (default = null) — Where your pass in your custom properties class.
|
| addAnswer | () | method |
public function addAnswer(addToAnswerList:Answer):voidAdds an answer to the Answer list.
The Answer List is requested by Captivate after the question has been submitted by the user.
Make sure you set up all your answers before or during the QuestionWidgetEvent.SUBMIT event, or submit() Template Method.
See the Answer class for more information on Answers.
Parameters
addToAnswerList:Answer — The answer being added to the Answer list.
|
See also
| clearAnswerList | () | method |
public function clearAnswerList():voidClears the Answer List of all Answers.
See also
| clearAnswers | () | method |
public function clearAnswers():voidA Template Method that is called when this question's 'Clear' button is pressed. Depending on what your Question Widget does, clearing it may mean any number of things.
In overriding this Template Method, you should code your widget so that it restores the question to its initial state. For example: In a drag and drop widget, you would move all draggable items back to their starting positions.
If you do not call super.resetAnswer() at the end of this function, the QuestionWidgetEvent.RESET_ANSWER Event will not be dispatched.
See also
| compareAnswers | () | method |
protected function compareAnswers(answerID:String, chosenAnswer:String, correctAnswer:String):void
A Template Method that is called when the user reviews the quiz and reaches this Question Widget.
It is called once for each Answer in the Answer List.
This method is called regardless of whether the question was answered correctly or incorrectly.
You can access the properties of the Answer through the passed in parameters.
override public function resetAnswer(answerID:String, chosenAnswer:String, correctAnswer:String):void {
trace(answerID);
trace(correctAnswer);
trace(chosenAnswer);
}
You need to enter an answerID when you create an Answer object,
because otherwise, there would be no way to identify the current answer from any others that were in the Answer List.
Parameters
answerID:String | |
chosenAnswer:String | |
correctAnswer:String |
See also
| disableAnswers | () | method |
public function disableAnswers():voidA Template Method that is called when the question's interactivity should be turned off.
This method is called when the question has been answered. It's called again when the Question Widget is being reviewed.
disableAnswers has a matching method of enableAnswers, which is called when the interactivity for the widget should be turned on.
Ideally, the actions of both these methods should cancel each other out, meaning Captivate could enable or disable the question as many times as it needs, and still result in no error.
If you do not call super.disableAnswers() at the end of this function, the QuestionWidgetEvent.ENABLE_ANSWERS Event will not be dispatched.
See also
| enableAnswers | () | method |
public function enableAnswers():voidA Template Method that is called when the question's interactivity should be turned on.
This method is usually called right when the question appears on screen.
It is considered better practice in the case of Question Widgets to override and put your runtime code in the enableAnswers() method instead of enterRuntime().
enableAnswers has a matching method of disableAnswers, which is called when the interactivity for the widget should be turned off.
Ideally, the actions of both these methods should cancel each other out, meaning Captivate could enable or disable the question as many times as it needs, and still result in no error.
If you do not call super.enableAnswers() at the end of the method, then the QuestionWidgetEvent.ENABLE_ANSWERS Event will not be dispatched.
See also
| setQuestionState | () | method |
public function setQuestionState(questionState:String):void
A Template Method called when the LMS returns the questionState string.
The questionState string can be read via the passed in
questionState property...
override public function setQuestionState(questionState:String):void {
onStage_txt.text = questionState;
}
questionState property in the QuestionWidget class.
override public function setQuestionState(questionState:String):void {
onStage_txt.text = this.questionState;
}
Because, as you see, there is a whole lotta difference there.
Parameters
questionState:String — The widget question state that has been passed in via the LMS.
|
See also
| submit | () | method |
protected function submit():void
A Template Method that is called when the 'Submit' button is pressed.
This method is called just before the question's results are sent off to Captivate.
In overriding to this Template Method, you should check whether the answer submitted by your widget
is complete and correct, then set the isCompleteAnswer and isCorrectAnswer properties accordingly.

See also
| triggerSubmitProcess | () | method |
public function triggerSubmitProcess():voidTells Captivate to start the Question Widget's submit process.
This is useful in the case that you have created a question where clicking the Submit button at the end would not make sense.
For example, if you had a widget where you had to win a car race, it wouldn't make sense to click the submit button after the car has crossed the finish line.
In that situation, you would call this method at the end of the race.
The submit() template method and WidgetEvent.SUBMIT event will both still be fired as if the user had clicked the submit button.
| clearAnswers | Event |
widgetfactory.events.QuestionWidgetEventwidgetfactory.events.QuestionWidgetEvent.CLEAR_ANSWERSDispatched when this question's 'Clear' button is pressed. Depending on what your Question Widget does, clearing it may mean any number of things.
In responding to this event, you should code your widget so that it restores the question to its initial state. For example: In a drag and drop widget, you would move all draggable items back to their starting positions.

See also
| compareAnswers | Event |
widgetfactory.events.QuestionWidgetEventwidgetfactory.events.QuestionWidgetEvent.COMPARE_ANSWERSDispatched when the user reviews the quiz and reaches this Question Widget. It is dispatched once for each
Answer in the Answer List.
This event is dispatched regardless of whether the question was answered correctly or incorrectly.
You can access the properties of the Answer object through the QuestionWidgetEvent object that is passed into the function.
addEventListener(QuestionWidgetEvent.COMPARE_ANSWERS, onCompareAnswer);
function onCompareAnswer (event:QuestionWidgetEvent):void {
trace(event.answerID);
trace(event.correctAnswer);
trace(event.chosenAnswer);
}
You need to enter an answerID when you create an Answer object,
because otherwise, there would be no way to identify the current answer from any others that were in the Answer List.
See also
| disableAnswers | Event |
widgetfactory.events.QuestionWidgetEventwidgetfactory.events.QuestionWidgetEvent.DISABLE_ANSWERSDispatched when your interactivity should be turned off.
This event is dispatched after the question has been answered. It's dispatched again when the Question Widget is being reviewed.
DISABLE_ANSWERS has a matching event of ENABLE_ANSWERS, which is dispatched when the interactivity for the widget should be turned on.
Ideally, these events should cancel each other out, meaning that Captivate could enable or disable the question as many times as it needs, and still result in no error.
See also
| enableAnswers | Event |
widgetfactory.events.QuestionWidgetEventwidgetfactory.events.QuestionWidgetEvent.ENABLE_ANSWERSDispatched when your interactivity should be turned on.
This event usually fires at the point when the question appears on screen.
It is considered better practice in the case of Question Widgets to use ENABLE_ANSWERS than ENTER_RUNTIME.
The reason for this recomendation is that ENABLE_ANSWERS has a matching event of DISABLE_ANSWERS, which is dispatched when the interactivity for the widget should be turned off.
Ideally, these events should cancel each other out, meaning that Captivate could enable or disable the question as many times as it needs, and still result in no error.
See also
| questionSubmitted | Event |
widgetfactory.events.QuestionWidgetEventwidgetfactory.events.QuestionWidgetEvent.QUESTION_SUBMITTEDDispatched when any native Captivate question type or Question Widget is submitted. With this event you can also read information about the quiz setup through the quizData property.
This event can be listened to by Static and Interactive Widgets, not just Question Widgets.
| setQuestionState | Event |
widgetfactory.events.QuestionWidgetEventwidgetfactory.events.QuestionWidgetEvent.SET_QUESTION_STATEDispatched when the LMS returns the
questionState string.
The questionState string can be read via the passed in
questionState property on the event object...
public function ConstructorFunction ()
{
addEventListener(QuestionWidgetEvent.SET_QUESTION, onSetQuestionState);
}
override public function onSetQuestionState(event:QuestionWidget):void {
onStage_txt.text = event.questionState;
}
questionState property in the QuestionWidget class.
ublic function ConstructorFunction ()
{
addEventListener(QuestionWidgetEvent.SET_QUESTION, onSetQuestionState);
}
override public function onSetQuestionState(event:QuestionWidget):void {
onStage_txt.text = questionState;
}
See also
| submit | Event |
widgetfactory.events.QuestionWidgetEventwidgetfactory.events.QuestionWidgetEvent.SUBMITDispatched when the 'Submit' button is pressed. This event is fired just before the question's results are sent off to Captivate. In responding to this event, you should check whether the answer submitted by your widget is complete and correct, then set the QuestionWidget's
isCompleteAnswer and isCorrectAnswer properties accordingly.

See also