Skip to main content
Inspiring
October 28, 2009
Answered

How to code root_go toAndPlay in AS3

  • October 28, 2009
  • 1 reply
  • 548 views

have to re do a site that was in AS2 to AS3, some code I have a problem with and can't seem to find the answer for is, I had a movieclip in frame 1 of the original AS2 timeline. When the clip ended I had an action in the last frame of the mc _root.gotoAndPlay("home") which after the clipended sent the main timeline to the home frame.

I have the same movieclip in the main timeline in the AS3 rework and need to know how to get the same result in AS3?

??

rderd

This topic has been closed for replies.
Correct answer Ned Murphy

Try: MovieClip(this.root).gotoAndPlay("home");

There is a best practice way to do this that does not involve using root/parent calls, and someone may jump in to offer it.  For now, the offering above is the quick and dirty solution that mimics the AS2 approach you described, and answers the title's question.

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
October 28, 2009

Try: MovieClip(this.root).gotoAndPlay("home");

There is a best practice way to do this that does not involve using root/parent calls, and someone may jump in to offer it.  For now, the offering above is the quick and dirty solution that mimics the AS2 approach you described, and answers the title's question.

mentlityAuthor
Inspiring
October 28, 2009

Once again Ned saves the day, as I had just found the same answer not 10 seconds before I got yours.

thx, I'm sure I will need to also find out another code problem as I go on.

thx

rdef