00:00
00:00
Newgrounds Background Image Theme

Grussellrussl just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

Help SharedObjects Saving Frame AS2

874 Views | 1 Reply
New Topic Respond to this Topic

Why doesnt this work?

I have created a Variable called savedFrame and then If its undefined it automatically turns into the green skin.
I open my Skin's menu, and press the Blue Skin button and it changes the data of the main character to the blue frame, and on the blue frame it tells it to save the data of savedFrame to the current frame, but when I reload the game; it isn't loading the blue skin...

Any help to where im going wrong ? Here are some code snippets (where, and how I'm using them)

ROOT FRAME
var savedFrame:Number = _root.so.data.savedFrame(); //Create savedFrame variable and link it to Save Data
//
if(so.data.savedFrame != undefined) {
_root.so.data.savedFrame = _root.char.mainchar.gotoAndStop("greenchar"); //If savedFrame unknown, auto change to green skin.
}
else{
_root.char.mainchar.gotoAndStop(_root.so.data.savedFrame); //If savedFrame not undefined, use savedFrame's data.
//
}

BLUE SKIN BUY BUTTON
on(release){
gotoAndStop(1);//Closes Skin Menu
_root.so.data.savedFrame = _root.char.mainchar.gotoAndStop("bluechar");//Changes savedFrame Data to Blue Skin frame.
}

ON MAINCHAR BLUE SKIN FRAME
var so:SharedObject = SharedObject.getLocal("PHONEGAME");
_root.so.data.savedFrame = _currentframe();//Save current frame as savedFrame's data.

THANKS TO ANYONE WHO CAN HELP ME


"Don't quote me boy cause' I ain't said shit" - Eazy-E

BBS Signature

Response to Help SharedObjects Saving Frame AS2 2017-08-28 08:41:27


In each of the brackets, put a few traces in and see what is and isn't getting called.