我有一個計時器警報:計時器警報 - 修正
private var cheat:Timer;
private function init():void {
cheat = new Timer(2000, 1);
cheat.addEventListener(TimerEvent.TIMER_COMPLETE, cheatProtection);
}
private function showAlert():void {
cheat.reset();
cheat.start();
}
private function alrt_close(evt:CloseEvent):void {
cheat.stop();
}
private function cheatProtection(evt:TimerEvent):void {
Alert.show("Text", "Label", Alert.OK, this, alrt_close);
}
所以,我做的是我叫出來showAlert(),但警報(cheatProtection功能)不會發生。哪裏不對?
感謝,顏
你是在你調用類的地方調用的init(),對不對? – 2010-08-31 20:19:27
嗯..我在做: rollOut =「showAlert()」 東西不見了? – Yan 2010-08-31 20:48:50
對,但是你在某個時候明確地調用了init()嗎?如果沒有,你的計時器永遠不會被創建。 (除非init()被自動調用;它已經有一段時間了,因爲我創建了一個Flex對象。) – 2010-08-31 21:03:05