在如此多的按钮点击后禁用flash中的2个按钮
我正在用flash制作一个文字游戏,我想在一个按钮数达到一定值后禁用2个按钮,但我所做的代码只需单击一下就可以禁用按钮。我已经为其他语言编写了类似的代码,所以我认为使用相同的基本语法不会太难。我是否需要更正for循环,或者我只是在if语句中犯了一个基本错误在如此多的按钮点击后禁用flash中的2个按钮,flash,actionscript,Flash,Actionscript,我正在用flash制作一个文字游戏,我想在一个按钮数达到一定值后禁用2个按钮,但我所做的代码只需单击一下就可以禁用按钮。我已经为其他语言编写了类似的代码,所以我认为使用相同的基本语法不会太难。我是否需要更正for循环,或者我只是在if语句中犯了一个基本错误 on (release){ var i; if(i >= 6) { vowel.enabled = false; cons.enabled = false; } i++; } 也许你应该像这样使用按钮索引值
on (release){
var i;
if(i >= 6)
{
vowel.enabled = false;
cons.enabled = false;
}
i++;
}
也许你应该像这样使用按钮索引值
on (release){
// somewhere you have to set index values your vowel and cons buttons
// notice that you shouldn't set these index on(release) function. You should set button index values global scope.
vowel.index = 0;
const.index = 1;
if(this.i >= 6)
{
if(i != vowel.index && i != cons.index) {
// enable other buttons this condition ignores vowel and cons buttons.
}
vowel.enabled = false;
cons.enabled = false;
}
this.i++;
}
顺便说一下,“const”是actionscript中的保留变量。我建议你改一下“constBtn”或其他名字。。。