how to record all appears in swf using AS3?
I am creating a card game and want to record all the movements of cards after login and choosing the 开发者_JS百科seat.
can anyone help in this that how could i record all appears in swf??
Thanks
then you need to create some class:
IterationTracking
or something, and after each iteration in your game just record them to array, or send to server
IterationTracking.addAction ( Iterationtracking.TYPE_SEAT_CHANGE, userID, [table, seat] );
IterationTracking.addAction ( Iterationtracking.TYPE_CARD_RECEIVED, userID, [H_Q] );
IterationTracking.addAction ( Iterationtracking.TYPE_CARD_FOLD, userID, [H_Q, H_4] );
IterationTracking.addAction ( Iterationtracking.TYPE_CARD_ON_TABLE, userID, [H_Q] );
function addAction ( type : String, userID : int, data : Array )
{
var action:Object = new Object();
action.userID = userID;
action.type = type;
action.data = data;
actions.push ( action );
// and if you need to do something on specific iteration then just switch case solution.
switch ( type )
{
case TYPE_CARD_RECEIVED :
//your actions
break;
case TYPE_CARD_FOLD :
//your actions
break;
// etc...
}
}
精彩评论