0
我正在做一個簡單的2按鈕菜單。每個按鈕都是一個帶有3個標籤的影片剪輯,用於「無」「選中」和「懸停」狀態。 smartBtn需要在輸入框中設置爲「selected」。當cinemaBtn被點擊時,smartBtn應該進入「無」狀態。但我不確定爲什麼smartBtn會繼續被選中。爲什麼按鈕保持選定狀態?
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.MouseEvent;
var smartBtn = menu_mc.smart_mc;
var cinemaBtn = menu_mc.cinema_mc;
smartBtn.buttonMode = true;
cinemaBtn.buttonMode = true;
this.addEventListener(Event.ENTER_FRAME, EnterFrameHandler);
smartBtn.addEventListener(MouseEvent.CLICK, menuSmartClick);
cinemaBtn.addEventListener(MouseEvent.CLICK, menuCinemaClick);
function EnterFrameHandler(event:Event):void {
smartBtn.gotoAndStop("selected");
}
function menuSmartClick(e:MouseEvent) {
smartBtn.gotoAndStop("selected");
smartBtn.buttonMode = false;
cinemaBtn.gotoAndStop("none");
cinemaBtn.buttonMode = true;
}
function menuCinemaClick(e:MouseEvent) {
cinemaBtn.gotoAndStop("selected");
cinemaBtn.buttonMode = false;
smartBtn.gotoAndStop("none");
smartBtn.buttonMode = true;
}