
Код AS3:
package
{
import flash.display.Sprite;
import flash.events.Event;
public class MyDispatcher extends Sprite
{
private var _someVar:int;
public function MyDispaycher()
{
super();
}
public function set someVar(value:int):void
{
this._someVar = value;
super.dispatchEvent(new Event(Event.CHANGE));
}
public function get someVar():int
{
return this._someVar;
}
}
}

Код AS3:
package
{
import flash.events.Event;
public class MyListener
{
private var _myDispatcher:MyDispatcher;
public function MyListener()
{
this._myDispatcher = new MyDispatcher();
this._myDispatcher.addEventListener(Event.CHANGE, onChange);
// ну и для проверочки
this._myDispatcher.someVar = 123;
}
private function onChange(event:Event):void
{
trace("ЭЭЭ!! Э! А НУ ЧО ТАМ: " + this._myDispatcher.someVar); // 123?
}
}
}