Controlling Movie Clips from the main time line instead of using their individual time lines?

Posted by Jess on Stack Overflow See other posts from Stack Overflow or by Jess
Published on 2009-09-06T01:36:07Z Indexed on 2010/03/24 21:03 UTC
Read the original article Hit count: 248

Filed under:
|
|

I have a Flash website template (four pages) that I made using AS 3.0 and Flash CS4. It is for an assignment involving movie clips. Currently on the main time line there is only one frame, and three layers: actions/menu/content.

The actionscript on the main time line is simply:

content_mc.stop ();

There is a movie clip on the stage called “Content” that contains the content for each of the pages.

Inside of that there is a “Menu” movie clip that contains and controls all of the navigation buttons. The actionscript for the Menu movie clip is:

function homeBtnPress (event:MouseEvent):void{
//comments here
//comments here
MovieClip(parent).content_mc.gotoAndStop("home");
}


function aboutBtnPress (event:MouseEvent): void{
MovieClip(parent).content_mc.gotoAndStop ("about");
}

function servicesBtnPress (event:MouseEvent): void{
MovieClip (parent).content_mc.gotoAndStop ("services");


}

function contactBtnPress (event:MouseEvent): void{
MovieClip (parent).content_mc.gotoAndStop ("contact");
}

function portfolioBtnPress (event:MouseEvent): void{
MovieClip (parent).content_mc.gotoAndStop ("portfolio");

}

home.addEventListener(MouseEvent.CLICK, homeBtnPress);
about.addEventListener(MouseEvent.CLICK, aboutBtnPress);
services.addEventListener(MouseEvent.CLICK, servicesBtnPress);
contact.addEventListener(MouseEvent.CLICK, contactBtnPress);
portfolio.addEventListener(MouseEvent.CLICK, portfolioBtnPress);

So everything works fine, but my instructor wants me to control the menu/content from the main time line by using the target path tool. What exactly would I target – just the “menu” and “content” movie clips, and what code would I use? Sorry if I'm not explaining very well, I'm pretty confused.

Here is the feedback from my instructor:

“While we learned how to control the main timeline and the timeline of another movie clip from within a movie clip, this is not the most intuitive way to script and makes for difficult debugging. So you will need to explore how to target your buttons inside of your menu movie clip and the frames within the content movie clip from the main timeline. “

Thanks so much in advance!

© Stack Overflow or respective owner

Related posts about actionscript-3

Related posts about movieclip