问题描述
我使用ActionScript 3做一个点,然后点击游戏。第1帧有两个按钮,按钮1和2,第3帧有两个按钮,按钮A和B.
I am using actionscript 3 to make a point and click game. On frame 1 there are two buttons, button 1 and 2. On frame 3 there are two buttons, button A and B.
我想它让我后点击第1帧按钮1,第3帧按钮A将被隐藏,或当我点击第1帧按钮2,第3帧按钮B将被隐藏。被隐藏的按钮不,当你点击他们做任何事情。
I want it so that after I click button 1 on frame 1, button A on frame 3 will be hidden or when I click button 2 on frame 1, button B on frame 3 will be hidden. The buttons that are hidden do not do anything when you click them.
在此先感谢
推荐答案
如果您尝试删除一些不显示列表中还没有的Flash会抛出一个错误。我想在这里最好的解决办法是建立一个时间轴变量来跟踪按钮,你有pressed。事情是这样的:
If you try to remove something that is not in the display list yet Flash will thrown an error. I guess the best solution here is setting up a timeline variable to keep track of which button you have pressed. Something like this:
第1帧
var b1:Boolean = false;
var b2:Boolean = false;
button1.addEventListener(MouseEvent.MOUSE_DOWN, checkButton);
button2.addEventListener(MouseEvent.MOUSE_DOWN, checkButton);
function checkButton(e:MouseEvent):void
{
if(e.target.name == button1) b1 = true;
else b2 = true;
gotoAndPlay(3);
}
在框架3
myButtomA.visible = false;
myButtomB.visible = false;
if (b1) myButtomA.visible = true;
if (b2) myButtomB.visible = true;
这篇关于如何隐藏点击闪存另一个按钮后,按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!