AS3: setChildIndex of targetSection + “_mc” to FRONT / accessing buttons on alpha:0 MC

I'm currently making a customisation app in Flash CS5 using AS3 & Greensock's TimelineMax.

The navigation is based on the Snorkl.TV Bullet proof portfolio which uses TimeLineMax to jump to labels in the timeline, and alpha in the appropraite MC. All the MCs [Garment_mc,Size_mc,Design_mc,Ink_mc,Options_mc,Checkout_mc] all sit on the same space on the stage on separate layers, and tween from x:-100 when their button is clicked.

This means that when the SWF is published the top most layer and it's MC cover the other MCs, and when you navigate to lower MCs, they are displayed underneath the alpha:0 MC, so the top-most MC's buttons/functions are still clickable and affect the previous choice (choose garment, next section, click something on that MC, it registers on the top-most MC).

I need the NavClick function to include something like... setChildIndex(targetSection + "_mc", 0) But I have been getting 1067: Implicit coercion errors.

Can anyone make any suggestions as to why? Or what I should do from here? Im racing towards my final hand-in date so any help would be great, THANK YOU!!


// all the section clips are fully visible on the stage
//we don't want to see them when the swf starts
//set up an array of section clips so that we can start them all with alpha=0;
var Panel_clips = [Garment_mc,Size_mc,Design_mc,Ink_mc,Options_mc,Checkout_mc];

for (var j:Number = 0; j < Panel_clips.length; j++)
    Panel_clips[j].alpha = 0;


var tl:TimelineMax = new TimelineMax({});
tl.timeScale = 1;

tl.addLabel("Garment_in", tl.duration);
tl.append(, 0, {alpha:1, immediateRender:false}));
tl.append(TweenMax.from(Garment_mc, .5, {x:-100, y:0, ease:Quart.easeOut}));

tl.addLabel("Garment_complete", tl.duration);
tl.append(, .5, {alpha:0}));

tl.addLabel("Size_in", tl.duration);
tl.append(, 0, {alpha:1, immediateRender:false}));
tl.append(TweenMax.from(Size_mc, .5, {x:-100, y:0, ease:Quart.easeOut}));

tl.addLabel("Size_complete", tl.duration);
tl.append(, .5, {alpha:0}));

tl.addLabel("Design_in", tl.duration);
tl.append(, 0, {alpha:1, immediateRender:false}));
tl.append(TweenMax.from(Design_mc, .5, {x:-100, y:0, ease:Quart.easeOut}));

tl.addLabel("Design_complete", tl.duration);
tl.append(, .5, {alpha:0}));

tl.addLabel("Ink_in", tl.duration);
tl.append(, 0, {alpha:1, immediateRender:false}));
tl.append(TweenMax.from(Ink_mc, .5, {x:-100, y:0, ease:Quart.easeOut}));

tl.addLabel("Ink_complete", tl.duration);
tl.append(, .5, {alpha:0}));

tl.addLabel("Options_in", tl.duration);
tl.append(, 0, {alpha:1, immediateRender:false}));
tl.append(TweenMax.from(Options_mc, .5, {x:-100, y:0, ease:Quart.easeOut}));

tl.addLabel("Options_complete", tl.duration);
tl.append(, .5, {alpha:0}));

tl.addLabel("Checkout_in", tl.duration);
tl.append(, 0, {alpha:1, immediateRender:false}));
tl.append(TweenMax.from(Checkout_mc, .5, {x:-100, y:0, ease:Quart.easeOut}));

tl.addLabel("Checkout_complete", tl.duration);
tl.append(, .5, {alpha:0}));


NavMc.addEventListener(MouseEvent.MOUSE_OVER, navOver);
NavMc.addEventListener(MouseEvent.MOUSE_OUT, navOut);
NavMc.addEventListener(MouseEvent.CLICK, navClick);
NavMc.buttonMode = true;

NavMc.GarmentBtn.ID = "Garment";
NavMc.SizeBtn.ID = "Size";
NavMc.DesignBtn.ID = "Design";
NavMc.InkBtn.ID = "Ink";
NavMc.OptionBtn.ID = "Options";
NavMc.CheckBtn.ID = "Checkout";

function navOver(e:MouseEvent):void
    //, .5, {tint:0x00CCFF});;

function navOut(e:MouseEvent):void
    //, .5, {tint:null});

function navClick(e:MouseEvent):void
    targetSection =;
    if (targetSection != currentSection)
        --> ?? //setChildIndex(targetSection + "_mc", 0)    <--------??????
        tl.tweenFromTo(targetSection + "_in", targetSection + "_complete");
        currentSection = targetSection;

        trace("you are already at " + currentSection);


//play through to home1_complete automatically on first run



In navClick function change this line:

targetSection =;

like this:

targetSection =;

because the setChildIndex function as first argument needs child movie itself , not his name/id.

Edited: In your case may be you should try also this: setChildIndex( getChildByName( + "_mc"),0);

Need Your Help

Ruby: Unable to do math operations with two arguments

ruby-on-rails ruby methods calculator

Please bear in mind that I am fairly new to Ruby. I am currently following a tutorial that is asking me to create a basic calculator. I need to create a Calculator class, that has the following met...

Define php var after textbox

php html variables

So I have a variable well defined in a php page and I'm using it in an HTML page using include.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.