Genesis John Dagdag
Genesis John Dagdag

Reputation: 23

How to create a button to save the current timeline in flash?

I have a game made by Flash CS5 ActionScript3. I want to create a button in the game where I can save the current timeline of the game. For example, I stopped at frame 5 and save the game. So when I load it, I should instantly return to frame 5. How can I do this? Thanks.

Upvotes: 0

Views: 699

Answers (2)

Romi Halasz
Romi Halasz

Reputation: 2009

You could also save the number of the frame in a settings file, of your application. Subsequently, when you restart the application, you can load that number in the initialization state, and render from that frame onward when the initialization is complete.

Have a great day.

Upvotes: 0

mgraph
mgraph

Reputation: 15338

like a cookie that stor data in your local machine

var mySharedObject:SharedObject = SharedObject.getLocal("myGameCookie");//creat a sharedobject

function saveCurrentFrame(){
    mySharedObject.data.lastframe= this.currentFrame;//save lastFramePosition
    mySharedObject.flush();
}

function getLastFrame():int{
  if(mySharedObject.data.lastframe){
    return mySharedObject.data.lastframe;
    };
}

function clearLastFrame(){
  mySharedObject.clear();
}

Upvotes: 4

Related Questions