Показать сообщение отдельно
Старый 05.08.2010, 01:17
GBee вне форума Посмотреть профиль Отправить личное сообщение для GBee Найти все сообщения от GBee
  № 2  
Ответить с цитированием
GBee
 
Аватар для GBee

Регистрация: Jan 2009
Сообщений: 3,067
Записей в блоге: 3
Отправить сообщение для GBee с помощью Skype™
Пример есть прямо в хелпе, вроде все понятно сразу.

Код AS3:
package {
        import flash.events.Event;
        import flash.display.Sprite;
 
        public class IEventDispatcherExample extends Sprite {
                public function IEventDispatcherExample() {
                        var decorDispatcher:DecoratedDispatcher = new DecoratedDispatcher();
                        decorDispatcher.addEventListener("doSomething", didSomething);
                        decorDispatcher.dispatchEvent(new Event("doSomething"));
                }
 
                public function didSomething(evt:Event):void {
                        trace(">> didSomething");
                }
        }
}
 
import flash.events.IEventDispatcher;
import flash.events.EventDispatcher;
import flash.events.Event;
 
class DecoratedDispatcher implements IEventDispatcher {       
    private var dispatcher:EventDispatcher;
 
    public function DecoratedDispatcher() {
        dispatcher = new EventDispatcher(this);
    }
 
    public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void{
        dispatcher.addEventListener(type, listener, useCapture, priority);
    }
 
    public function dispatchEvent(evt:Event):Boolean{
        return dispatcher.dispatchEvent(evt);
    }
 
    public function hasEventListener(type:String):Boolean{
        return dispatcher.hasEventListener(type);
    }
 
    public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void{
        dispatcher.removeEventListener(type, listener, useCapture);
    }
 
    public function willTrigger(type:String):Boolean {
        return dispatcher.willTrigger(type);
    }
}
__________________
Чтобы доказать, что вы не робот, причините вред другому человеку.