Sunday, April 5, 2009

Moving the maintimeline ahead in flash from within another clip!

Hey all! So I have run across this bridge many times in Flash CS3. How do I make a Clip move from within another clip?? Let's say I have a character. He walks across the stage. Then I have a separate character. I want one character to walk, and then at the end of the other character's movement jump ahead to the next scene.

First I create a new MovieClip using Cmd+F8, lets call this "Character1" in the instance name.

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

Welcome!

Hi all. I wanted to start this blog as an informative tool, and a sharing place for code customization in Adobe Creative Suite Products and more! My focus will be automation of cumbersome tasks, effects, tools, animation, and production of digital files! I hope I can share some great info and provide a service to many graphic artists!

My website, for reference is www.caseygovero.com.