package { import flash.events.EventDispatcher; /** * @author Sergey Gonchar * @version 0.1 */ public class ValueHolder extends EventDispatcher { private var value:*; private var type:Class; public function ValueHolder(value:*, type:Class) { this.value = value; this.type = type; } public function get Value():*{ return value; } public function set Value(value:*):void { if (!(value is this.type)) { throw("Invalid data type") }; if (this.value == value) return; var oldValue:* = this.value; this.value = value; this.dispatchEvent(new ChangeEvent(oldValue, this.value)); } } }