Skip to main content
Inspiring
October 11, 2007
Answered

control main timeline with as3

  • October 11, 2007
  • 3 replies
  • 320 views
I'm having some problems playing the main timeline from one of it's children. In actionscript 2 the command would have been:
_root.gotoAndPlay(2);

How is this done with actionscript 3?
root.gotoAndPlay(2) does not work since root is a DisplayObject instead of a MovieClip.
This topic has been closed for replies.
Correct answer kglad
cast it as a movieclip.

3 replies

kglad
Community Expert
Community Expert
October 11, 2007
not always. but frequently the flash compiler looses track of what's what.
brad9376Author
Inspiring
October 11, 2007
I have just found that this works:
(root as MovieClip).gotoAndPlay(2);

Does root always have to be cast to a MovieClip like this? I'm using it in a class that extends MovieClip.
kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
October 11, 2007
cast it as a movieclip.