這是簡單的代碼,但我無法解決.. 我clik a.button,所以計時器運行,但如果我點擊b.button,計時器stil正在運行。如何停止這個計時器?由於 (對不起我的英文不好)不能停止計時器AS3
a.addEventListener(MouseEvent.CLICK, starts);
function starts(e:MouseEvent)
{
time(0);
}
b.addEventListener(MouseEvent.CLICK, stops);
function stops(e:MouseEvent)
{
time(1);
}
function time(cc)
{
var timer:Timer = new Timer(1000,100);
timer.addEventListener(TimerEvent.TIMER, tmer);
timer.start();
function tmer(e:TimerEvent):void
{
trace("start");
}
if(cc == 1)
{
trace("stop");
timer.stop();
timer.removeEventListener(TimerEvent.TIMER, tmer);
}
cc=0;
}
hmmmm ..感謝的BitmapData .. – dikagaulzzz 2013-02-11 02:21:42