下面是我的按钮代码,我面临的问题是,一旦单击按钮,单击下一个按钮后将无法再次工作。我想启用上一个单击的按钮。我希望专家可以在这里帮助我。
pages.gotoAndStop("home");
// list of button instance names
var buttonsss:Array = [home, menudown.about, menudown.portfolio, menudown.clients, menudown.pricing, menudown.contact];
for each ( var mc:MovieClip in buttonsss)
{
mc.buttonMode = true;
mc.mouseChildren = false;
mc.addEventListener(MouseEvent.MOUSE_UP, onClick, false, 0, true);
mc.addEventListener(MouseEvent.ROLL_OVER, rolloverEffect, false, 0, true);
mc.addEventListener(MouseEvent.ROLL_OUT, rolloutEffect, false, 0, true);
}
function onClick(e:MouseEvent):void
{
pages.gotoAndStop(e.target.name);
TweenLite.to(e.currentTarget,2,{tint:0xFF0000, ease:Strong.easeOut});
var myTween:Tween = new Tween(pages, "alpha", Strong.easeOut, 0, 1, 2, true);
e.currentTarget.removeEventListener(MouseEvent.ROLL_OUT, rolloutEffect);//disable the roll out effect
e.currentTarget.removeEventListener(MouseEvent.MOUSE_UP, onClick);//disable the roll out effect
e.currentTarget.removeEventListener(MouseEvent.ROLL_OVER, rolloverEffect);//disable the roll out effect
}
function rolloverEffect(e:MouseEvent):void{
TweenLite.to(e.currentTarget,2,{tint:0x000000, ease:Strong.easeOut});
}
function rolloutEffect(e:MouseEvent):void{
//should change tint to null just when its enabled, but its changing always (enabled or disabled)
TweenLite.to(e.currentTarget,2,{tint:null , ease:Strong.easeOut});
}