我目前正在使用AS3&amp ;;在Flash CS5中制作自定义应用程序。 Greensock的TimelineMax。
导航基于Snorkl.TV Bullet proof portfolio,它使用TimeLineMax跳转到时间轴中的标签,以及appropraite MC中的alpha。所有MC [Garment_mc,Size_mc,Design_mc,Ink_mc,Options_mc,Checkout_mc]都位于舞台上不同图层上的相同空间,并且在单击按钮时从x:-100补间。
这意味着当SWF发布时最顶层并且它的MC覆盖其他MC,当您导航到较低的MC时,它们显示在alpha:0 MC下方,因此最顶级的MC按钮/功能仍然可以点击并影响之前的选择(选择服装,下一部分,点击该MC上的某些内容,它会在最顶级的MC上注册)。
我需要NavClick功能来包含类似...... setChildIndex(targetSection +“_ mc”,0) 但是我得到了1067:隐含的强制错误。
有人可以提出任何建议吗?或者我应该从这里做些什么?我正在争取最后的参与日期,所以任何帮助都会很棒,谢谢!
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");
//
答案 0 :(得分:0)
在navClick
函数中更改此行:
targetSection = e.target.ID;
像这样:
targetSection = e.target;
因为作为第一个参数的setChildIndex
函数需要子电影本身,而不是他的名字/ id。
<强>编辑:强>
在你的情况下,你应该尝试这个:
setChildIndex( getChildByName(e.target.ID + "_mc"),0);