-
global or root?
hello,
For most of my flash scripts, i have been using _root. for variables that being used by different scripts in different areas,
but i have recently noticed that _root. does not affect scripts in different scenes,
say that i have have _root.hello = 10; in scene 1, and I also have that in scene 2,
now if i change _root.hello in scene 1, my _root.hello in scene 2 will not change
I experimented on using _global but it doesnt work either,
is there a similar script to _root. that might be able to change variables in between scenes? (im using MX7)
thx a bunch!
-
huh?
both _root and _global should work in different scenes... :confused:
-
From what you say it is logical that it works the way it does.
If you define the variable in both scenes new and only chance it in one scene it will still be redefined in the other scene and therefore be another value.
So what you should do is define the variable and then only change it in the scenes but not redefine it all the time.
example:
you have this code in
scene 1: _root.hello=10;
scene 2:_root.hello++;
scene 3: trace(_root.hello);
whenever you go to scene 1 it will be reset to 10
whenever you go to scene 2 it will be increased by one
and it will be traced as the current number in scene three