-
Notifications
You must be signed in to change notification settings - Fork 0
MathGames Methods
MathGames.instance.connect (
container:DisplayObjectContainer,
// This will be the parent of the MathGames panels.
config:Object
// A collection of parameters used to set up the question engine.
) :voidThe provided container must be attached to the stage when connect is invoked. Valid options for configuration are as follows:
var configuration:Object = {
"api_key": "528e1abeb4967cb32b00028e",
// (REQUIRED) Specifies the API Key used to access the question service.
"pool_key": "LEVEL_ONE",
// (REQUIRED) Specifies the desired default question pool.
"log_func": trace
// (OPTIONAL) A function expecting a string which will be invoked with
// debug messages.
}MathGames.instance.selectSkill () :voidOpens the Skill Select panel to allow the player to select a skill. This must be called before any calls to startSession.
A game using the MathGames service consists of a series of play sessions where questions are presented to the player one after the other. Play sessions happen between a call to startSession and a call to endSession. During the session, QUESTION_READY events are fired. Once the player has reached a milestone, such as completing a level, endSession should be called, and showProgress may be invoked to get some summary information about the player's progress.
MathGames.instance.startSession (
config:Object
// A collection of parameters used to configure the next play session.
) :voidThis method accepts a configuration object, and a callback function which is invoked when the questions are ready and the gameplay session can begin.
Valid options for configuration are as follows:
var configuration:Object = {
"pool_key": "LEVEL_ONE",
// (OPTIONAL) Specifies the desired question pool to use for this session.
// If none is provided then the previously specified one is used.
"clear_progress": true,
// (OPTIONAL) Clears accumulated progress which is viewed in the
// showProgress screen.
}MathGames.instance.endSession () :voidThis method accepts no parameters and returns nothing. You can assume that, immediately after calling endSession, the session is complete. You can then show menus, cutscenes, or anything related to the game which is not part of the question-answering sessions.
MathGames.instance.showProgress () :voidThe showProgress method pops up a summary panel showing the progressions and skills which the player has accumulated since the previous call to showProgress. It should be called when the player reaches a milestone in the game, such as completing a level, and it's appropriate to show some summarizing information about the player's progress so far.
MathGames.instance.showSupportedSkillStandards () :voidDisplays a list of all curriculum mappings supported by the MathGames SDK, and highlights the ones supported by the current game. Currently does not fire an event when closed since it's typically invoked from the main menu where nothing behind the panel is time-critical.
MathGames.instance.postMetrics (
key:String,
data:Object
) :voidPost custom metrics events to the MathGames servers. You can track these events from your developer dashboard on mathgames.com.
MathGames.instance.setSoundEnabled (
enabled:Boolean
) :voidToggles built-in sounds in the MathGames SDK screens and popups.
MathGames.instance.moreMathGames () :voidOpens MathGames.com in a browser.