Packageimpression.players
Classpublic class MultipleSelectPlayer
InheritanceMultipleSelectPlayer Inheritance BasePlayer Inheritance flash.events.EventDispatcher

The MultipleSelectPlayer class supports playback of multiple-choice/multiple-select type storyboards, including those with text or graphic responses. A multiple-select storyboard consists of a question and a number of responses. Each response must be marked as either correct or incorrect. The responses are assigned position indicies, which are used to determine the onscreen ordering of the items.

Once the question and responses have been placed onscreen, the user will select any number of responses. Once responses have been selected, the question can be evaluated and scored.

The MultipleSelectPlayer class is a face-based player; all drawing and interaction is handled by the shell. Like most face-based players, the MultipleSelectPlayer class is designed to encapsulate the logic required to manage multiple-choice questions and make the development of multiple-choice/multiple-select question interfaces as simple as possible.



Public Properties
 PropertyDefined By
 InheritedalwaysCheckComplete : Boolean
Specifies how the object should handle storyboard completion.
BasePlayer
  correct : Boolean
[read-only] true if all responses marked correct have been evaluated and there are no responses that are incorrect (not marked correct) that have been evaluated, false else.
MultipleSelectPlayer
  isPracticeQuestion : Boolean
[read-only] true if the question is marked as a practice question, false else.
MultipleSelectPlayer
  locked : Boolean
Indicates whether the responses for the storyboard are locked, preventing selection.
MultipleSelectPlayer
  maximumResponses : int
[static] Indicates the maximum number of responses to be processed.
MultipleSelectPlayer
 InheritednarrationComplete : Boolean
Indicates whether narration has finished playing.
BasePlayer
  status : String
[read-only] The status of the question in the current storyboard.
MultipleSelectPlayer
  storyboard : Storyboard
[override] Specifies the storyboard for the player.
MultipleSelectPlayer
  strictSelection : Boolean
Specifies how the class should handle selection of invalid response indices.
MultipleSelectPlayer
  totalEvaluated : Number
[read-only] The total number of evaluated responses in the current storyboard.
MultipleSelectPlayer
  totalEvaluatedCorrect : Number
[read-only] The total number of evaluated responses marked correct in the current storyboard.
MultipleSelectPlayer
  totalEvaluatedIncorrect : Number
[read-only] The total number of evaluated responses not marked correct in the current storyboard.
MultipleSelectPlayer
  totalMarkedCorrect : Number
[read-only] The total number of valid responses marked as correct in the current storyboard.
MultipleSelectPlayer
  totalMarkedIncorrect : Number
[read-only] The total number of valid responses not marked as correct in the current storyboard.
MultipleSelectPlayer
  totalResponses : Number
[read-only] The total number of valid responses in the current storyboard.
MultipleSelectPlayer
  totalSelected : Number
[read-only] The total number of responses selected in the current storyboard.
MultipleSelectPlayer
  totalSelectedCorrect : Number
[read-only] The total number of selected responses marked correct in the current storyboard.
MultipleSelectPlayer
  totalSelectedIncorrect : Number
[read-only] The total number of selected responses not marked correct in the current storyboard.
MultipleSelectPlayer
Public Methods
 MethodDefined By
 Inherited
Causes the player to examine the completion criteria for the current storyboard.
BasePlayer
  
deselectResponseAt(index:Number):void
Deselects the response at index.
MultipleSelectPlayer
  
evaluate():void
Evaluates the selected responses.
MultipleSelectPlayer
  
[static] Creates a string describing the state of the storyboard.
MultipleSelectPlayer
  
indexOf(propertyName:String):Number
Returns the index of the propertyName.
MultipleSelectPlayer
  
isResponseAtEvaluated(index:Number):Boolean
Returns true if the response is evaluated, false else.
MultipleSelectPlayer
  
isResponseAtMarkedCorrect(index:Number):Boolean
Returns true if the response is marked as correct, false else.
MultipleSelectPlayer
  
isResponseAtSelected(index:Number):Boolean
Returns true if the response is selected, false else.
MultipleSelectPlayer
  
resetEvaluatedValues(restoreSelections:Boolean):void
Resets the evaluated response properties for each response.
MultipleSelectPlayer
  
resetResponseAt(index:Number):void
Resets the selected and evaluated response properties for each response.
MultipleSelectPlayer
  
Resets the selected and evaluated response properties for each response.
MultipleSelectPlayer
  
[static] Removes all properties set by the player.
MultipleSelectPlayer
  
responseAt(index:Number):String
Returns the persisted property name of the response at index.
MultipleSelectPlayer
  
responseValueAt(index:Number, defaultValue:*):*
Returns the persisted property value of the response at index.
MultipleSelectPlayer
  
selectResponseAt(index:Number):void
Selects the response at index.
MultipleSelectPlayer
  
setStoryboardState(sb:Storyboard, state:String):void
[static] Modifies the storyboard to match the described state passed.
MultipleSelectPlayer
  
toggleResponseSelectionAt(index:Number):void
Toggles the response at index.
MultipleSelectPlayer
Protected Methods
 MethodDefined By
  
[override] Initializes the storyboard.
MultipleSelectPlayer
  
[override] Loads the storyboard.
MultipleSelectPlayer
  
[override] Removes known completion criteria from the CompleteRemaining storyboard persisted property.
MultipleSelectPlayer
 Inherited
Performs cleanup actions when a storyboard is unloaded.
BasePlayer
Events
 Event Summary Defined By
 InheritedDispatched when the BasePlayer needs to resolve completion criteria beyond those defined for the class.BasePlayer
 InheritedDispatched when a storyboard is marked as complete.BasePlayer
 InheritedDispatched after a storyboard is initialized.BasePlayer
 InheritedDispatched when storyboard loading is complete.BasePlayer
 InheritedDispatched when a storyboard is loaded, but before any processing occurs.BasePlayer
  Dispatched when the evaluate() method is invoked.MultipleSelectPlayer
  Dispatched when a selection is changed, or when the storyboard is first loaded.MultipleSelectPlayer
 InheritedDispatched before a storyboard is unloaded.BasePlayer
Property Detail
correctproperty
correct:Boolean  [read-only]

true if all responses marked correct have been evaluated and there are no responses that are incorrect (not marked correct) that have been evaluated, false else. If the storyboard property value is null, false is returned.

This method returns the value of the current storyboard's Correct persisted property.


Implementation
    public function get correct():Boolean
isPracticeQuestionproperty 
isPracticeQuestion:Boolean  [read-only]

true if the question is marked as a practice question, false else. If the storyboard property value is null, true is returned.

This method returns the value of the current storyboard's IsPracticeQuestion persisted property.


Implementation
    public function get isPracticeQuestion():Boolean
lockedproperty 
locked:Boolean

Indicates whether the responses for the storyboard are locked, preventing selection.

This property sets or returns the value of the current storyboard's Locked persisted property.


Implementation
    public function get locked():Boolean
    public function set locked(value:Boolean):void
maximumResponsesproperty 
maximumResponses:int

Indicates the maximum number of responses to be processed.

The player will process properties named "Response[n]" where [n] is a number between 1 and maximumResponses.

The default value is 9.


Implementation
    public static function get maximumResponses():int
    public static function set maximumResponses(value:int):void
statusproperty 
status:String  [read-only]

The status of the question in the current storyboard. If the storyboard property value is null, the empty string ("") is returned. This value will be one of the QuestionStatusTypes constant values.

This method returns the value of the current storyboard's Status persisted property.


Implementation
    public function get status():String

See also

storyboardproperty 
storyboard:Storyboard[override]

Specifies the storyboard for the player.

If null is passed, the current storyboard is unloaded, the StoryboardEvent.UNLOAD event is dispatched, and no further action occurs.

If a non- null storyboard object is passed, the following actions occur, in order:

  1. If the previously loaded storyboard is not null, the StoryboardEvent.UNLOAD event is dispatched. If the event is not cancelled, the current storyboard is unloaded. If the event is cancelled, further processing stops.
  2. The StoryboardEvent.LOAD_START event is dispatched. If the event is not cancelled, the new storyboard is associated with the player. If the event is cancelled, further processing stops and the value of this property is set to null.
  3. If the value of the new storyboard's Initialized persisted property is false, the storyboard is initialized and the StoryboardEvent.INITIALIZE event is dispatched.
  4. The MultipleSelectEvent.SELECTION_CHANGE event is dispatched.
  5. The StoryboardEvent.LOAD_COMPLETE event is dispatched.
  6. The checkForComplete() method is invoked. If all completion criteria have been met, the StoryboardEvent.COMPLETE event is dispatched.


Implementation
    public function get storyboard():Storyboard
    public function set storyboard(value:Storyboard):void

See also

strictSelectionproperty 
strictSelection:Boolean

Specifies how the class should handle selection of invalid response indices.

If this property value is true, invoking the selectResponseAt() method causes the player to examine the value of the response at the passed index prior to selection. If the index paramter is invalid, or the response at index is null, the empty string (""), or an AssetData object whose filename member value is null or the empty string, no action is taken. If this property value is false, no additional checks are performed.

The default value is true.


Implementation
    public function get strictSelection():Boolean
    public function set strictSelection(value:Boolean):void

See also

totalEvaluatedproperty 
totalEvaluated:Number  [read-only]

The total number of evaluated responses in the current storyboard. If the storyboard property value is null, -1 is returned.

This method returns the value of the current storyboard's TotalEvaluated persisted property.


Implementation
    public function get totalEvaluated():Number
totalEvaluatedCorrectproperty 
totalEvaluatedCorrect:Number  [read-only]

The total number of evaluated responses marked correct in the current storyboard. If the storyboard property value is null, -1 is returned.

This method returns the value of the current storyboard's TotalEvaluatedCorrect persisted property.


Implementation
    public function get totalEvaluatedCorrect():Number
totalEvaluatedIncorrectproperty 
totalEvaluatedIncorrect:Number  [read-only]

The total number of evaluated responses not marked correct in the current storyboard. If the storyboard property value is null, -1 is returned.

This method returns the value of the current storyboard's TotalEvaluatedIncorrect persisted property.


Implementation
    public function get totalEvaluatedIncorrect():Number
totalMarkedCorrectproperty 
totalMarkedCorrect:Number  [read-only]

The total number of valid responses marked as correct in the current storyboard. If the storyboard property value is null, -1 is returned.

This method returns the value of the current storyboard's TotalMarkedCorrect persisted property.


Implementation
    public function get totalMarkedCorrect():Number
totalMarkedIncorrectproperty 
totalMarkedIncorrect:Number  [read-only]

The total number of valid responses not marked as correct in the current storyboard. If the storyboard property value is null, -1 is returned.

This method returns the value of the current storyboard's TotalMarkedIncorrect persisted property.


Implementation
    public function get totalMarkedIncorrect():Number
totalResponsesproperty 
totalResponses:Number  [read-only]

The total number of valid responses in the current storyboard. If the storyboard property value is null, -1 is returned.

This method returns the value of the current storyboard's TotalResponses persisted property.


Implementation
    public function get totalResponses():Number
totalSelectedproperty 
totalSelected:Number  [read-only]

The total number of responses selected in the current storyboard. If the storyboard property value is null, -1 is returned.

This method returns the value of the current storyboard's TotalSelected persisted property.


Implementation
    public function get totalSelected():Number
totalSelectedCorrectproperty 
totalSelectedCorrect:Number  [read-only]

The total number of selected responses marked correct in the current storyboard. If the storyboard property value is null, -1 is returned.

This method returns the value of the current storyboard's TotalSelectedCorrect persisted property.


Implementation
    public function get totalSelectedCorrect():Number
totalSelectedIncorrectproperty 
totalSelectedIncorrect:Number  [read-only]

The total number of selected responses not marked correct in the current storyboard. If the storyboard property value is null, -1 is returned.

This method returns the value of the current storyboard's TotalSelectedIncorrect persisted property.


Implementation
    public function get totalSelectedIncorrect():Number
Method Detail
deselectResponseAt()method
public function deselectResponseAt(index:Number):void

Deselects the response at index.

If the storyboard property value is null or is locked, or the strictSelection property value is true and the response at index is not valid, does not exist, or is empty, invoking this method has no effect.

Invoking this method will select the response and may result in the aggregate status and/or scoring information to be changed. The player will also dispatch a MultipleSelectEvent.SELECTION_CHANGE event.

Unlike toggleResponseSelectionAt, this method will not remove the evaluated property value from the response

Parameters

index:Number — The index of the response to select.

See also

evaluate()method 
public function evaluate():void

Evaluates the selected responses.

Invoking this method causes the evaluated properties for each selected response to be set and the selected response properties to be cleared. Aggregate/summary information, including the status property is updated, and a MultipleSelectEvent.EVALUATE event is dispatched. After dispatching the evaluate event, a MultipleSelectEvent.SELECTION_CHANGE event is dispatched.

If the storyboard property value is null, or there are no selected responses, invoking this method has no effect.

Note that previously evaluated responses are not reset. Use one of the reset method before invoking this method if you don't want this behavior.

See also

getStoryboardState()method 
public static function getStoryboardState(sb:Storyboard):String

Creates a string describing the state of the storyboard.

This method returns a multiple-character string to describe the state of the storyboard. The size of the string will depend on the number of distractors and the aggregate state. Index data, selected/evaluated response data, lock data, and scoring data are all included (or can be recreated from) the state string. The returned string may contain upper- and lower-case letters, numbers, and the dot (.) character.

Note that this string only describes the state that the player is aware of. If the shell stores additional data in the storyboard, it is the shell's responsibility to store the additional data if it is needed.

Parameters

sb:Storyboard — The storyboard to describe the state of.

Returns
String — The state of the storyboard.

See also

indexOf()method 
public function indexOf(propertyName:String):Number

Returns the index of the propertyName. If the storyboard property value is null, -1 is returned. If propertyName is null or the empty string (""), 0 is returned. If no index value can be found for propertyName, -1 is returned.

This method returns the value of the current storyboard's [propertyName]Index persisted property.

Parameters

propertyName:String — The property name to return the index of.

Returns
Number — The index of propertyName.
initializeStoryboard()method 
override protected function initializeStoryboard():void

Initializes the storyboard.

This method is invoked by the storyboard property set method when a non-null storyboard object is loaded and its Initialized persisted property value is false. The storyboard property set method will dispatch the initialized event after invoking this method.

The MultipleSelectPlayer initializes a storyboard by performing the following actions:

See also

isResponseAtEvaluated()method 
public function isResponseAtEvaluated(index:Number):Boolean

Returns true if the response is evaluated, false else. If the storyboard property value is null, true is returned.

This method uses the Response[n]Index and Response[n]Evaluated persisted property values.

Parameters

index:Number — The index to retrieve the response's persisted property value of.

Returns
Booleantrue if the response is selected, false else.
isResponseAtMarkedCorrect()method 
public function isResponseAtMarkedCorrect(index:Number):Boolean

Returns true if the response is marked as correct, false else. If the storyboard property value is null, true is returned.

This method uses the Response[n]Index and Response[n]Correct persisted property values.

Parameters

index:Number — The index to retrieve the response's persisted property value of.

Returns
Booleantrue if the response is marked as correct, false else.
isResponseAtSelected()method 
public function isResponseAtSelected(index:Number):Boolean

Returns true if the response is selected, false else. If the storyboard property value is null, true is returned.

This method uses the Response[n]Index and Response[n]Selected persisted property values.

Parameters

index:Number — The index to retrieve the response's persisted property value of.

Returns
Booleantrue if the response is selected, false else.
loadStoryboard()method 
override protected function loadStoryboard():void

Loads the storyboard.

This method is invoked by the storyboard property set method when a non-null storyboard object is loaded after initialization (if needed) occurs.

When loading a storyboard, the MultipleSelectPlayer performs the following actions:

See also

removeCompleteRemainingCriteria()method 
override protected function removeCompleteRemainingCriteria():void

Removes known completion criteria from the CompleteRemaining storyboard persisted property.

This method is invoked by the checkForComplete() method if the value of the storyboard property is not null, and the complete event has not been dispatched since the storyboard was loaded.

In addition to the substrings processed by the BasePlayer, the MultipleSelectPlayer will remove the following substrings from the completeRemaining persisted property:

SubstringMeaning
answerCorrect;The value of the correct property is true.
answerEvaluated;The value of the totalEvaluated property is > 0.

See also

resetEvaluatedValues()method 
public function resetEvaluatedValues(restoreSelections:Boolean):void

Resets the evaluated response properties for each response.

This method removes the Response[n]Evaluated properties from each response. If the restoreSelections parameter value is true, the response's selected property value will be set to true if its evaluated property was also true.

Invoking this method will update aggregate/summary information, and if any of the above properties are removed, the player will dispatch a MultipleSelectionEvent.SELECTION_CHANGE event.

Parameters

restoreSelections:Boolean — Specifies whether or not evaluated responses are selected after reset.

See also

resetResponseAt()method 
public function resetResponseAt(index:Number):void

Resets the selected and evaluated response properties for each response.

This method removes the the current storyboard's Response[n]Selected and Response[n]Evaluated persisted property values, if present. Aggregate/summary information is updated, and if any of the above properties are removed, the player will dispatch a MultipleSelectionEvent.SELECTION_CHANGE event.

Parameters

index:Number — The index of the response to reset.

See also

resetResponses()method 
public function resetResponses():void

Resets the selected and evaluated response properties for each response.

This method removes the the current storyboard's Response[n]Selected and Response[n]Evaluated persisted property values, if present. Aggregate/summary information is updated, and if any of the above properties are removed, the player will dispatch a MultipleSelectionEvent.SELECTION_CHANGE event.

See also

resetStoryboard()method 
public static function resetStoryboard(sb:Storyboard):void

Removes all properties set by the player.

Note that this method also removes interim completion properties used by the player, but not necessarily set by the player.

Parameters

sb:Storyboard — The storyboard to remove properties from.

This method removes the following properties from a storyboard:

  • Initialized
  • CompleteRemaining
  • Complete
  • NarrationComplete
  • The Complete property of each ChildElement object in the storyboard's Commands ChildElementCollection property, if it exists.
  • TotalResponses
  • TotalMarkedCorrect
  • TotalMarkedIncorrect
  • TotalSelected
  • TotalSelectedCorrect
  • TotalSelectedIncorrect
  • TotalEvaluated
  • TotalEvaluatedCorrect
  • TotalEvaluatedIncorrect
  • Status
  • Correct
  • Locked
  • IndexesGenerated

For values of [n] between 1 and MultipleSelectPlayer.maximumResponses, the following properties will be removed:

  • Response[n]Selected
  • Response[n]Evaluated
  • Response[n]Valid
  • Response[n]Index (if the ResponseIndexesGenerated persisted property value was true)

See also

responseAt()method 
public function responseAt(index:Number):String

Returns the persisted property name of the response at index. If the storyboard property value is null, index is less than 1, or no response property can be found at index, the empty string (quot;quot;) is returned.

The return value (if not the empty string) will be of the form "Response[n]" where [n] is a value between 1 and MultipleSelectPlayer.maximumResponses. This method uses the Response[n]Index persisted property values of the current storyboard.

Parameters

index:Number — The index to retrieve the response's persisted property name of.

Returns
String — The property name of the response at index.
responseValueAt()method 
public function responseValueAt(index:Number, defaultValue:*):*

Returns the persisted property value of the response at index. If the storyboard property value is null, index is less than 1, or no response property can be found at index, the defaultValue is returned.

This method uses the Response[n]Index persisted property values of the current storyboard.

Parameters

index:Number — The index to retrieve the response's persisted property value of.
 
defaultValue:* — A default value to return if the property at index cannot be found.

Returns
* — The property value of the response at index, or defaultValue.
selectResponseAt()method 
public function selectResponseAt(index:Number):void

Selects the response at index.

If the storyboard property value is null or is locked, or the strictSelection property value is true and the response at index is not valid, does not exist, or is empty, invoking this method has no effect.

Invoking this method will select the response and may result in the aggregate status and/or scoring information to be changed. The player will also dispatch a MultipleSelectEvent.SELECTION_CHANGE event.

Parameters

index:Number — The index of the response to select.

See also

setStoryboardState()method 
public static function setStoryboardState(sb:Storyboard, state:String):void

Modifies the storyboard to match the described state passed.

If the value of state indicates a completed storyboard, interim completion criteria will be marked as complete in addition to the overall storyboard state.

State values created using a function other than getStoryboardState may not work.

Parameters

sb:Storyboard — The Storyboard object to modify.
 
state:String — A String created using the getStoryboardState() method containing the state to restore.

See also

toggleResponseSelectionAt()method 
public function toggleResponseSelectionAt(index:Number):void

Toggles the response at index.

If the response is selected, invoking this method will deselect the response. If the response is not selected, but is evaluated, invoking this method will "unevaluate" the response. If the response is neither selected nor evaluated, invoking this method will select the response.

If the storyboard property value is null or is locked, or the strictSelection property value is true and the response at index is not valid, does not exist, or is empty, invoking this method has no effect.

Invoking this method may result in a change of the aggregate status and/or scoring information. The player will also dispatch a MultipleSelectEvent.SELECTION_CHANGE event.

Parameters

index:Number — The index of the response to toggle.

See also

Event Detail
multipleSelectEvaluate Event
Event Object Type: impression.events.MultipleChoiceEvent
MultipleChoiceEvent.type property = impression.events.MultipleSelectEvent.EVALUATE

Dispatched when the evaluate() method is invoked.

The MultipleSelectEvent.EVALUATE constant defines the value of the type property of a evaluate event object. This event has the following properties:
PropertyValue
bubblesfalse
cancelablefalse; there is no default behavior to cancel.
currentTargetThe object that is actively processing the Event object with an event listener.
targetThe object that raised the event.
sbThe Storyboard object assigned to the target.

See also

multipleSelectSelectionChange Event  
Event Object Type: impression.events.MultipleChoiceEvent
MultipleChoiceEvent.type property = impression.events.MultipleSelectEvent.SELECTION_CHANGE

Dispatched when a selection is changed, or when the storyboard is first loaded.

The MultipleSelectEvent.SELECTION_CHANGE constant defines the value of the type property of a multiple select selection change event object. This event has the following properties:
PropertyValue
bubblesfalse
cancelablefalse; there is no default behavior to cancel.
currentTargetThe object that is actively processing the Event object with an event listener.
targetThe object that raised the event.
sbThe Storyboard object assigned to the target.

See also