How To Access the Main Timeline in Flash Actionscript 3

I recently had to port a project that I am working on to Actionscript 3 from Actionscript 2. It was a pretty smooth transition until I came to a point where I needed to access the main timeline within a dynamically placed movieclip. I was tearing my hair out trying to figure out how to freaking access the main timeline!

Long story short
In Actionscript 2 it would be:

root.gotoAndStop(5);

To do this in Actionscript 3:

MovieClip(this.root).gotoAndStop(5);

I'm not exactly sure why this works the way it does, but it does. I had to get the Yoda of Actionscript to help me out with it. Here is a simple FLA (Flash version CS3) example. Access Main Timeline Example

Leave me a comment if you've found this helpful, Good luck!

Comments

1

you're brilliant. i love you! thank you very much, i've been struggling for 3 days to figure out that one

Add new comment