1

Flash CS4, AS2

I am making a Flash tour. I have 3 sections: About, Rentals, Neighborhood. All the sections are within MCs on the same Frame. I am using conditonal statements on the Nav buttons to turn the visibility on/off in order to navigate the tour. However, now when the same button is pressed, the MC toggles on/off.

I want to disable the button when it is pressed and then enable the button when the other two buttons are pressed.

How do I write this code?

Thanks!

4

2 回答 2

0

我可以建议布兰登答案的变体吗?为什么不将最后一个 selectedButton 存储在一个变量中并不断更新该变量,而不是一次又一次地循环遍历所有按钮。当然,对于几个按钮,它不会有太大的不同,但这只是一个想法。

var buttonList:Array = [aboutButton, rentalButton, neighborhoodButton];
var selectedButton;

function selectButton():Void {
    selectedButton.enabled = true; 
    this.enabled = false;
    selectedButton = this;
}

for (i=0; i<buttonList.length; ++i) {
    buttonList[i].onRelease = selectButton;
}
于 2009-08-31T19:09:32.993 回答
0

这是基本思想:

var buttonList:Array = [aboutButton, rentalButton, neighborhoodButton];

function selectButton():Void {
    for (i=0; i<buttonList.length; ++i) {
        buttonList[i].enabled = true;
    }

    this.enabled = false;
}

for (i=0; i<buttonList.length; ++i) {
    buttonList[i].onRelease = selectButton;
}

aboutButton.onRelease();
于 2009-08-31T18:09:56.237 回答