


October 05, 2014 – gotoAndPlay Inside MovieClip AS 3.0
Some developers migrating to Action Script 3.0, may have problems with buttons inside Movie Clip, the example below is a very common problem when the statement gotoAndPlay is used inside a button that is inside a MovieClip.
The developer uses the following statement to go to some frame in the Main Timeline:
gotoAndPlay(6);
If the button was created direct in the frame, the above code will work of course, but if the button is inside a Movie Clip on the stage, the code will not work and you need to use the code below instead:
MovieClip(parent).gotoAndPlay(6);
I will put a image below to show you better, the entire scenario of this common problem:
The number six is just an example number of the destination frame in the Main Timeline that we want to go, you need to put the number of your frame in this place instead.
The developer uses the following statement to go to some frame in the Main Timeline:
gotoAndPlay(6);
If the button was created direct in the frame, the above code will work of course, but if the button is inside a Movie Clip on the stage, the code will not work and you need to use the code below instead:
MovieClip(parent).gotoAndPlay(6);
I will put a image below to show you better, the entire scenario of this common problem:

The number six is just an example number of the destination frame in the Main Timeline that we want to go, you need to put the number of your frame in this place instead.
© PlayGB.com - Free online games - Blog
