Hello - I am trying to use Shared Objects for scoring and am not able to get it to work. I know how to use SO for entering names, (to create and write to the SO, and retrieving and displaying the SO data )but I can't figure out how to use it for scoring.
My goal is to create a single SO, and to write to it using an On (press) event to add and subtract points (+/- 10 points), and display this score (SO data) so the user can see it and when they leave and reenter the swf it displays their score. There would be multiple swf interactions writing to the same SO so the score SO would be read/written to by multiple swfs and the current score would be displayed as you enter different swfs.
Here's what I have so far. There would also be a dynamic text field labeled "score".
swf frame 1 code:
_root.score=0;
button code:
on (press) {
_root.score++;
if( init == null )
init = true;
so = SharedObject.getLocal( "score", "/");
if( (score != null) )
//checks if the input box contains data
{
so.data.score = score;
//gets input box variable content and updates shared object "score"
so.flush();
//sends new score input variable to the learner's local machine
}
}
}
Can anyone help me fill in the gaps??
thanks!
My goal is to create a single SO, and to write to it using an On (press) event to add and subtract points (+/- 10 points), and display this score (SO data) so the user can see it and when they leave and reenter the swf it displays their score. There would be multiple swf interactions writing to the same SO so the score SO would be read/written to by multiple swfs and the current score would be displayed as you enter different swfs.
Here's what I have so far. There would also be a dynamic text field labeled "score".
swf frame 1 code:
_root.score=0;
button code:
on (press) {
_root.score++;
if( init == null )
init = true;
so = SharedObject.getLocal( "score", "/");
if( (score != null) )
//checks if the input box contains data
{
so.data.score = score;
//gets input box variable content and updates shared object "score"
so.flush();
//sends new score input variable to the learner's local machine
}
}
}
Can anyone help me fill in the gaps??
thanks!