Reputation: 37
I need to go frame-label "5", when my hero hits an enemy object. So I want to know how to use gotoAndStop
from my external custom class to control Stage timeline.
So how exactly could I access gotoAndStop
and what's the syntax to use for running that gotoAndStop
method from the custom class.
Thanks in Advance.
Upvotes: 0
Views: 186
Reputation: 2457
You just have to write in your if
statement:
MovieClip(root).gotoAndStop("5");
Upvotes: 1
Reputation: 5255
There are several ways to achieve this.
A simple solution could be to pass the main timeline to the external class, like so:
public function ExternalClass(timeline:MovieClip)
With this as the constructor of your class, you get a reference to the movieclip that should be played.
Another, better solution would be to execute the hittest on the main time line or dispatch an Event from the class that does the hittest.
Upvotes: 0