0
我從SO上的另一個問題得到以下代碼來跟蹤計數器的變化值。AS3 - 檢測變量變化並將值傳遞給監聽者
package com.my.functions
{
import flash.events.Event;
import flash.events.EventDispatcher;
public class counterWithListener extends EventDispatcher
{
public static const VALUE_CHANGED:String = 'counter_changed';
private var _counter:Number = 0;
public function counterWithListener() { }
public function set counter(value:Number):void
{
_counter = value;
this.dispatchEvent(new Event(counterWithListener.VALUE_CHANGED));
}
}
}
我想要做的就是通過計數器的值之前,我改變了它,以及新價值的聽衆,所以我可以在新的值是否有效決定。
感謝 - 看起來不錯。將現在進行測試。 – Josh 2009-06-29 21:55:49