lundi 23 janvier 2017

AS3/AIR Save/Load multiple usernames using SharedObject

I am trying to create an Android application created using Adobe Flash Actionscript 3. I wanted each user of the app to input their name in the beginning of the application, then they have the capability to save their progress in current frame (and it will be saved into a save slot or similar). However, the problem arises when another user is going to use the app, he/she must enter a distinct username, and he/she can save anytime (and load his/her distinct load progress, different from the previous user.). And it goes on.

I am a newbie in programming and I hope you could help me. Any suggestions will be appreciated. Thanks!

This my code for creating a username and saving it:

function handleClick(Event:MouseEvent):void
    var myFirstVariable = boxOne.text;
    boxTwo.text = myFirstVariable;
myButton2.addEventListener(MouseEvent.MOUSE_UP, handleClick);

Here is my code for saving and loading:

var mySharedObject:SharedObject = SharedObject.getLocal("save");

btnSave.addEventListener(MouseEvent.CLICK, saveCurrentFrame);
btnLoad.addEventListener(MouseEvent.CLICK, getLastFrame);

function saveCurrentFrame(event:MouseEvent):void
{ = currentFrame;

function getLastFrame(event:MouseEvent):void
    if ( != null)

Aucun commentaire:

Enregistrer un commentaire