【发布时间】:2014-02-02 23:00:28
【问题描述】:
我正在修复别人的代码,一切都完成了 Flash CS5 上的 actionscript 3.0。这是动作脚本:
var buttons = ["suspend", "dissolve"];
// there are two buttons on the screen. One says 'Suspend' and the other says 'dissolve'.
// When 'suspend' is clicked, information on the word 'suspend' fades in onto the screen
// and, if information on the word 'dissolve' is on the screen, it disappears.
// When 'dissolve' is clicked, information on the word 'dissolve' fades in onto the screen
// and, if information on the word 'suspend' is on the screen, it disappears.
// the code below explains this:
function changeContent (mc:MovieClip):void{
for (var i: int = 0; i < buttons.length ; i++){
if (buttons[i].associated == mc){ // if 'suspend' or 'dissolve' is clicked
tweenA = new Tween (buttons[i].associated, "alpha", Strong.easeOut, buttons[i].associated.alpha, 1, tweenSpeed, false);
// the line above makes the information corresponding to the button fade in
}else{
buttons[i].associated.alpha = 0; // otherwise make the information corresponding to the button disappear
}
}
checkDone (); // checks if both buttons are clicked.. this part works fine
}
现在,此动画有效,当我单击“暂停”时,“暂停”信息消失在视图中,而溶解信息消失,反之亦然。但是,如果单击“暂停”,然后很快单击“溶解”(如果我一个接一个地单击两个按钮,非常快),则“暂停”信息和“溶解”信息但出现并重叠彼此。好像这条线
buttons[i].associated.alpha = 0; // this line is supposed to make the button which
// isn't clicked disappear
如果两个按钮一个接一个地点击就不起作用,真的很快。知道如何解决这个问题吗?
【问题讨论】:
标签: actionscript-3 flash alpha-transparency