Package | impression.players |
Class | public class MultipleSelectPlayer |
Inheritance | MultipleSelectPlayer ![]() ![]() |
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.
Property | Defined By | ||
---|---|---|---|
![]() | alwaysCheckComplete : 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 | ||
![]() | narrationComplete : 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 |
Method | Defined By | ||
---|---|---|---|
![]() | checkForComplete():void
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 | ||
getStoryboardState(sb:Storyboard):String [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 | ||
resetResponses():void
Resets the selected and evaluated response properties for each response. | MultipleSelectPlayer | ||
resetStoryboard(sb:Storyboard):void [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 |
Method | Defined By | ||
---|---|---|---|
initializeStoryboard():void [override]
Initializes the storyboard. | MultipleSelectPlayer | ||
loadStoryboard():void [override]
Loads the storyboard. | MultipleSelectPlayer | ||
[override]
Removes known completion criteria from the CompleteRemaining storyboard persisted property. | MultipleSelectPlayer | ||
![]() | unloadStoryboard():void
Performs cleanup actions when a storyboard is unloaded. | BasePlayer |
Event | Summary | Defined By | ||
---|---|---|---|---|
![]() | Dispatched when the BasePlayer needs to resolve completion criteria beyond those defined for the class. | BasePlayer | ||
![]() | Dispatched when a storyboard is marked as complete. | BasePlayer | ||
![]() | Dispatched after a storyboard is initialized. | BasePlayer | ||
![]() | Dispatched when storyboard loading is complete. | BasePlayer | ||
![]() | Dispatched 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 | |||
![]() | Dispatched before a storyboard is unloaded. | BasePlayer |
correct | property |
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.
public function get correct():Boolean
isPracticeQuestion | property |
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.
public function get isPracticeQuestion():Boolean
locked | property |
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.
public function get locked():Boolean
public function set locked(value:Boolean):void
maximumResponses | property |
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
.
public static function get maximumResponses():int
public static function set maximumResponses(value:int):void
status | property |
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.
public function get status():String
See also
storyboard | property |
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:
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.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
. Initialized
persisted property is false
, the storyboard is initialized and the StoryboardEvent.INITIALIZE
event is dispatched.MultipleSelectEvent.SELECTION_CHANGE
event is dispatched.StoryboardEvent.LOAD_COMPLETE
event is dispatched.checkForComplete()
method is invoked. If all completion criteria have been met, the StoryboardEvent.COMPLETE
event is dispatched. public function get storyboard():Storyboard
public function set storyboard(value:Storyboard):void
See also
strictSelection | property |
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
.
public function get strictSelection():Boolean
public function set strictSelection(value:Boolean):void
See also
totalEvaluated | property |
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.
public function get totalEvaluated():Number
totalEvaluatedCorrect | property |
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.
public function get totalEvaluatedCorrect():Number
totalEvaluatedIncorrect | property |
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.
public function get totalEvaluatedIncorrect():Number
totalMarkedCorrect | property |
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.
public function get totalMarkedCorrect():Number
totalMarkedIncorrect | property |
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.
public function get totalMarkedIncorrect():Number
totalResponses | property |
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.
public function get totalResponses():Number
totalSelected | property |
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.
public function get totalSelected():Number
totalSelectedCorrect | property |
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.
public function get totalSelectedCorrect():Number
totalSelectedIncorrect | property |
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.
public function get totalSelectedIncorrect():Number
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.
|
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.
|
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:
Response[n]Valid
properties for each response based on the content.TotalResponses
, TotalMarkedCorrect
, and TotalMarkedIncorrect
persisted properties.Response[n]Index
and IndexesGenerated
persisted propertie values are set.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.
|
Boolean — true 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.
|
Boolean — true 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.
|
Boolean — true 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:
Substring | Meaning |
---|---|
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:
For values of [n] between
|
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.
|
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.
|
* — 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
multipleSelectEvaluate | Event |
impression.events.MultipleChoiceEvent
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:Property | Value |
---|---|
bubbles | false |
cancelable | false ; there is no default behavior to cancel. |
currentTarget | The object that is actively processing the Event object with an event listener. |
target | The object that raised the event. |
sb | The Storyboard object assigned to the target. |
See also
multipleSelectSelectionChange | Event |
impression.events.MultipleChoiceEvent
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:Property | Value |
---|---|
bubbles | false |
cancelable | false ; there is no default behavior to cancel. |
currentTarget | The object that is actively processing the Event object with an event listener. |
target | The object that raised the event. |
sb | The Storyboard object assigned to the target. |
See also