0
如何讓按鈕在點擊時保持其向下或向上狀態,然後再次點擊時又恢復到向上狀態?如何讓按鈕在點擊時保持在超過或低於狀態?
如何讓按鈕在點擊時保持其向下或向上狀態,然後再次點擊時又恢復到向上狀態?如何讓按鈕在點擊時保持在超過或低於狀態?
import flash.events.Event;
var clicked = false; //Make a variable that stores the current state.
button_mc.addEventListener(MouseEvent.CLICK, toggleState);
function toggleState(e:Event){
clicked = !clicked; //Toggle the current state
(clicked) ? button_mc.gotoAndPlay(2) : button_mc.gotoAndPlay(1);
//if clicked is true, go to the clicked frame in the button
//(you might have flags, in which case, name them in quotes,
//butt_mc.gotoAndPlay("clicked")), otherwise go to the first
//frame (which should be the upstate)
}
它是一個flash組件按鈕,一個從simpleButton類擴展的按鈕,還是一個您自己創建的全新按鈕? – Xiler