First I create a new MovieClip using Cmd+F8, lets call this "Character1" in the instance name.
MovieClip(this.parent).gotoAndStop(2);
So I throw the clip on the stage from within the library. Then I add a stop(); action in the main timeline to stop the playhead. My character clip will still animate if given an animation
I double click within the clip and add these actions to a timeline layer:
MovieClip(this.parent).gotoAndStop(2);
What this action does is it tells our main timeline to go to frame 2 and stop.
From within the MovieClip. this.parent is the reference to the main timeline,
or the parent of our child timeline.
gotoAndStop(2); of course tells it frame 2.
This script could be added to a Button Event Listener as well,
just give the button an instance name of Button:
Button.addEventListener(MouseEvent.CLICK, Button_CLICK);
function Button_CLICK(e:MouseEvent):void
{
MovieClip(this.parent).gotoAndStop(2);
}
Here are the files for this Example:
http://caseygovero.com/MovingTimeline.zip
No comments:
Post a Comment