Flash Challenge.setCustomInformation()

From J2Play

Jump to: navigation, search

Contents

Description

Set the expandable challenge information which developer can use to store game state and other stuffs. It is a map with Key => Array of Values

Syntax

public function setCustomInformation(key : String, index: Number, value : String);

Parameters

* @param key the name of data key
* @param index the array index of value array, if index = -1 means the value is not a array.
* @param object for save

Return Value

N/A

Examples

Set the game seed related to this challenge and save it to challenge at game start. Then challenge receiver call restore it.

challenge.setCustomInformation('game_seed',-1,game_seed);
challenge.updateGameStart();

Set the flag number of every player, save and update the challenge information for next player's turn

var flag: Array;
// player2 win a flag from player1
flag[0]-=1;
flag[1]+=1;
challenge.setCustomInformation('player_flag',0,flag[0]);
challenge.setCustomInformation('player_flag',1,flag[1]);
challenge.updateNextTurn(0,false);
Personal tools