all groups > flash actionscript > january 2006 >
You're in the

flash actionscript

group:

Storing variable problem


Re: Storing variable problem tralfaz
1/21/2006 3:53:13 PM
flash actionscript:
[quoted text, click to view]

Use default to set the value the first time..

switch(mynumber) {
case 1: mynumber++;
doSomethingElse();
break;

case 2: mynumber++;
doSomeStuff();
break;

default: // in case it is uninitialized or zero value,
mynumber = 1; // init value
break;
}

tralfaz

Storing variable problem mac monkey
1/21/2006 11:08:23 PM
Hi, I have a switch statement in the first frame of my movie in which case 1
incriments the value of the switch to 2 when it is finished and 2 to 3 etc.
However, obviously i need to initialise a variable but if i do this in the
frame, as the frame is paused the initialised variable always takes over.

Where can i initialise the variable so it will only be read from there once?
Re: Storing variable problem kglad
1/21/2006 11:42:35 PM
if(!initializedVariables){
// initialize your variables;
initializedVariables=1;
AddThis Social Bookmark Button