我目前正在使用AS3 &Greensock的TimelineMax在闪存CS5中制作一个定制应用程序。
导航基于Snorkl.TV Bullet proof portfolio,它使用TimeLineMax跳到时间线中的标签,并使用alpha跳到适当的MC中。所有的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:隐式强制错误。
有没有人能给出什么建议?或者我应该从这里做什么?我正在赶着我最后的交接日期,所以任何帮助都是很好的,谢谢!
启动代码。
// 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");
//发布于 2013-05-03 20:32:34
在navClick function中,更改以下行:
targetSection = e.target.ID;如下所示:
targetSection = e.target;因为作为第一个参数的setChildIndex函数需要子电影本身,而不是他的名字/id。
编辑:在你的情况下,可能是你也应该尝试一下:
setChildIndex( getChildByName(e.target.ID + "_mc"),0);
https://stackoverflow.com/questions/16358571
复制相似问题