Skip to main content
Participant
May 20, 2023
Question

How to access a root variable from inside a movie clip

  • May 20, 2023
  • 1 reply
  • 143 views

Hi I need help. This is really simple but I cannot get it to work.

 

I define a variable on the root timeline:

var result:uint = 0;

 

and want to ask for this variable inside of a movieclip 

if ((this.parent).result == 0) {
trace("xxx")
} else {
 
In a AS2 there was only to add "_root" or "_parent" etc.
How can I get that value of the variable? Or is "Var" the wrong thing and I can define something like "Global"?
trace("yyy")
};*/
 
 
This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
May 20, 2023

in canvas/html5, exportRoot

 

any variable declared with var only exists in the frame in which it was declared and doesn't even exist if that frame plays again (unless it's defined again).