Reputation:
I just switched to AS3 I am having problem accessing variables of the timeline from MovieClips. In AS2 we used to do _root.myvar, I checked for references, I found _root
is root
now in AS3.
I have a variable isValid
on the root timeline and My code inside a movieclip needs the value of that variable for some checks. I did this:
MovieClip Frame 1:
if(root.isValid == true)
{
this.gotoAndStop(4);
}
It returned some undefined property error on that.
please help
thank You
Upvotes: 4
Views: 195
Reputation: 629
You need to cast the root to a MovieClip:
if(MovieClip(root).isValid == true)
{
this.gotoAndStop(4);
}
it should work then..
Upvotes: 1