I've got the following code from another question on SO to track the changing value of a counter.
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));
}
}
}
What I would like to do is pass the value of the counter before I changed it as well as the new value to the listener so I can decide on whether the new value is valid.