7/13/2011

as2 as3 按下去兩個事件交錯出現 Boolean

//as2-----------------------------------
var isPlaying:Boolean;//創造Boolean

HD_btn.onRelease = function() {
   
if (isPlaying) {
        trace("繼續播2");
        isPlaying = false;
        land1.gotoAndStop(1);
    } else {
        trace("繼續播");
        isPlaying = true;
        land1.gotoAndStop(2);
    }
}

//as3-----------------------------------
var isPlaying:Boolean;

R_LOGO.addEventListener(MouseEvent.CLICK, clickStop);

function clickStop(evt:MouseEvent) {

    if (isPlaying) {
        isPlaying = false;
        trace("繼續播1");
    } else {
        trace("繼續播2");
        isPlaying = true;
    }

}

No comments:

Post a Comment