Skip to main content
Inspiring
August 6, 2013
Answered

A question about keeping a number

  • August 6, 2013
  • 1 reply
  • 647 views

Hey guys...

Is there a way where if I have a number in one frame (for instance) and I go to the next frame... if I go back to the original frame to keep that number?

Like:

Frame 1 I have a score and it keeps updating.

Frame 2 shows me something and after a while it goes back to frame 1

How do I keep that score instead of starting all over?

Thanks!!!

This topic has been closed for replies.
Correct answer Ned Murphy

In the first frame you can use a conditional to check if the variable exists.  If not, declare it and assign it its starting value.

if(!count){

    var count = 0;

}

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
August 6, 2013

In the first frame you can use a conditional to check if the variable exists.  If not, declare it and assign it its starting value.

if(!count){

    var count = 0;

}

SirMarleyAuthor
Inspiring
August 6, 2013

You´re the man. Thanks!!!!!!

Ned Murphy
Legend
August 6, 2013

You're welcome