-
undefined variables?
Hi
I defined a variable in frame one of my flash as =0, and when it goes to frame 2 it says this variable is undefined. I tried the same with a boolean variable and it also says false for frame one, but changes to undefined when it enters frame 2
Any suggestions as to why it is doing this?
Thanks
-
var numVar:Number = 0;
put this in the actions panel on frame 1
-
You need to declare the variable by adding 'Var' before your code.
-
I put var numVar:Number = 0; in frame one in the actions layer (in scene 2 where I need it) and it's still saying undefined when I enter frame 2
-
-
have you tried adding the code in frame 2, or alternatively you can declare a global variable.
-
Originally Posted by ilike2
have you tried adding the code in frame 2, or alternatively you can declare a global variable.
I only want the variable to be 0 when it is initially loaded which is why I put it in frame 1. You have to go and find objects in other frames which will change the variable, and then you can see which objects you've found in frame 2 because the variable has changed.
-
You have a .fla file? Not sure what is happening to cause this. Is the variable being set at the _root or inside a movieclip?
Var keyword is not needed in AS2 (although recommended).
-
I used _root and it worked
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|