|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Internal variable through the frames
Hello!
I have a small issue and just wonder if somebody faced the same problem and knows how to solve it. I need to perform some operations on the internal variable and have persistence through the frames in timeline. But for some reasons either because my variable is not global or any other I can't achieve situation when my next frame accesses variable that has been modified in the previous frame. In other words my variable become constant and I can perform operations only within a frame. If somebody knows how to change variable content through frames and monitor this changes I will appreciate that. Regards, Leo |
|
#2
|
|||
|
|||
|
hello,
as a work around, just make the variable global ![]() add _global to the front of it: _global.myVar = "something"; and when you refer to it, just sa "myVar". you only need the _global in the declaration. cheers, bret |
|
#3
|
|||
|
|||
|
Global variable is not accessible
Thank You bret,
but it doesn't work with me. I had first frame with global declaration but on the next keyframe when I try to access the variable I can't do it. Is it only declaration I can make? _global.myVar = "test"; Regards, Leo |
|
#4
|
|||
|
|||
|
hum...
if you say (on any line of code/frame before you need the variable): _global.myVar = "test"; //at any point after that, you should be able to reference myVar: trace(myVar); //or if(myVar=="test"){ trace("myVar :" + myVar); } or whatever you want to do with that... i know that script executes like it should... copy and paste into your movie and then adapt it to the variable you need... one thing to keep in mind is that you can't have *any* local variables named the same thing... If the variable overwrites the _global variable, it will fail silently... cheers, bret |
![]() |
| Viewing: Dev Shed Forums > Web Design > Flash Help > Internal variable through the frames |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|