我正在使用用 AS2 构建的 flash 菜单。它做了它应该做的事情:如果你点击菜单中的一个按钮,这个按钮进入一个选定的状态,最重要的是,这个按钮只有在另一个按钮被释放时才会淡出。你可以在这里看到演示:
http://activeden.net/item/buttons-section-selected/6100
它适用于以下代码:**
//SET STAGE
Stage.scaleMode = "noScale"
//SET BUTTONS TEXT (Here you can change the buttons name)
b1.MC_btnTxt.TXT.text = "Button 1";
b2.MC_btnTxt.TXT.text = "Button 2";
b3.MC_btnTxt.TXT.text = "Button 3";
b4.MC_btnTxt.TXT.text = "Button 4";
b5.MC_btnTxt.TXT.text = "Button 5";
/*CREATE THE BUTTONS ARRAY(if you wanna add or delete
buttons you have to ad or delete the istance button name from the list*/
var myArray = [b1,b2,b3,b4,b5];
//CREATE FUNCTIONS FOR THE BUTTONS ANIMATION
function overBtn (){
for (j=0; j<myArray.length; j++) {
myArray[j].onRollOver = function(){
this.gotoAndPlay(2);
}
myArray[j].onRollOut = function(){
this.gotoAndPlay("fadeOut");
}
}
}
function releaseStatus() {
for (a=0; a<myArray.length; a++) {
myArray[a].enabled = false;
}
deselection();
}
function deselection() {
for (b=0; b<myArray.length; b++) {
if (b<>selectedBtn) {
myArray[b].enabled = true;
if(myArray[b]._currentframe==32)
myArray[b].gotoAndPlay("selectionFadeOut");
}
}
}
// SET BUTTONS
b1.onRelease = function() {
sectionTXT.text = "Section 1"
selectedBtn = 0;
releaseStatus();
this.gotoAndPlay("selectionFadeIn");
}
b2.onRelease = function() {
sectionTXT.text = "Section 2"
selectedBtn = 1;
releaseStatus();
this.gotoAndPlay("selectionFadeIn");
}
b3.onRelease = function() {
sectionTXT.text = "Section 3"
selectedBtn = 2;
releaseStatus();
this.gotoAndPlay("selectionFadeIn");
}
b4.onRelease = function() {
sectionTXT.text = "Section 4"
selectedBtn = 3;
releaseStatus();
this.gotoAndPlay("selectionFadeIn");
}
b5.onRelease = function() {
sectionTXT.text = "Section 5"
selectedBtn = 4;
releaseStatus();
this.gotoAndPlay("selectionFadeIn");
}
//INIT INTERFACE
overBtn();
问题是,如果您想在按钮(b1、b2、b3...)内添加一个按钮,则内部按钮不起作用。例如:下面的代码不适用于其中一个主按钮 (b5) 内的按钮。
b5.ex .onRelease = function ()
{
this.gotoAndStop("selectionInnerButton");
}
;
我的问题是:为了使内部按钮正常工作,我应该在代码中进行哪些更改?
谢谢!