lundi 9 janvier 2017

Save and Load current frame in Actionscript 3 (Adobe Flash AIR)

I have an interactive flash application Actionscript 3 to be deployed in Android device (thru Adobe Air). There will be a Save button (btnSave) that will save current progress of a user eventhough he closes the app or another will use it. There's also a Load button (btnLoad) to load the progress of the user. This is my code and I can't make it work. Thanks!

var mySharedObject:SharedObject = SharedObject.getLocal(“save”);

btnSave.addEventListener(MouseEvent.CLICK, saveCurrentFrame);

function saveCurrentFrame(event:MouseEvent):void

{
mySharedObject.data.lastframe= this.currentFrame;
mySharedObject.flush();
}

btnLoad.addEventListener(MouseEvent.CLICK, getLastFrame);

function getLastFrame():int

{
return mySharedObject.data.lastframe;
} 

Aucun commentaire:

Enregistrer un commentaire