Knightley
asked on
about how flash works
hi, guys:
i am working on a pretty huge flash program, abd are having some problem with functions.
e.g.
function trace_projectile(x){
_root.a=0;
_root.a+=x;
... ... ... //many lines
trace(_root.a);
}
say if i use it several times, could it be, that there maybe some conflict in _root.a.
i mean, that the time i trace _root.a, the same function somewhere else just
set it back to 0 or so.
are functions in flash used one after another, or could they be used parallel???
if the later, i am afraid i must change the function using different variables. :(
i am working on a pretty huge flash program, abd are having some problem with functions.
e.g.
function trace_projectile(x){
_root.a=0;
_root.a+=x;
... ... ... //many lines
trace(_root.a);
}
say if i use it several times, could it be, that there maybe some conflict in _root.a.
i mean, that the time i trace _root.a, the same function somewhere else just
set it back to 0 or so.
are functions in flash used one after another, or could they be used parallel???
if the later, i am afraid i must change the function using different variables. :(
ASKER
i do want to the a set back to 0 every time i call the function.
i mean if i use the function twice,
do they run one after another or parallel?
i mean if i use the function twice,
do they run one after another or parallel?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You need to define the Initial Value of _root.a outside of your function like this.
_root.a=0;
function trace_projectile(x){
_root.a+=x;
... ... ... //many lines
trace(_root.a);
}
This way function will Grab Variable "a" Value once, outside of your function.