1

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!!

NAIGATION CODE.

// 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(TweenMax.to(Garment_mc, 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(TweenMax.to(Garment_mc, .5, {alpha:0}));



tl.addLabel("Size_in", tl.duration);
tl.append(TweenMax.to(Size_mc, 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(TweenMax.to(Size_mc, .5, {alpha:0}));



tl.addLabel("Design_in", tl.duration);
tl.append(TweenMax.to(Design_mc, 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(TweenMax.to(Design_mc, .5, {alpha:0}));



tl.addLabel("Ink_in", tl.duration);
tl.append(TweenMax.to(Ink_mc, 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(TweenMax.to(Ink_mc, .5, {alpha:0}));


tl.addLabel("Options_in", tl.duration);
tl.append(TweenMax.to(Options_mc, 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(TweenMax.to(Options_mc, .5, {alpha:0}));


tl.addLabel("Checkout_in", tl.duration);
tl.append(TweenMax.to(Checkout_mc, 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(TweenMax.to(Checkout_mc, .5, {alpha:0}));


//SET UP THE NAV

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
{
    //TweenMax.to(e.target, .5, {tint:0x00CCFF});
    e.target.nextFrame();
    //e.target.GotoAndStop(e.target.NextFrame);
    //trace("Rolled");
}

function navOut(e:MouseEvent):void
{
    //TweenMax.to(e.target, .5, {tint:null});
    //trace(e.target.ID);
    e.target.gotoAndPlay(1);
}



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


    }else{
        trace("you are already at " + currentSection);
        }

}


//play through to home1_complete automatically on first run
tl.tweenTo("Garment_complete");


//
4

1 回答 1

0

In navClick function change this line:

targetSection = e.target.ID;

like this:

targetSection = e.target;

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(e.target.ID + "_mc"),0);

于 2013-05-03T12:32:33.770 回答