方法一:
function assignHandlers(target:*):void
{
target["addEventListener"](Event.COMPLETE,eventHandler);
target["addEventListener"](IOError.IO_ERROR,ioErrorHandler);
.......
}
function eventHandler(e:event):void
{
.......
}
.......
function ioErrorHandler(e:event):void
{
.......
}
方法二:
function configureListeners(dispatcher:IEventDispatcher):void
{
dispatcher.addEventListener(Event.COMPLETE, eventHandler);
....
dispatcher.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
}
function eventHandler(e:event):void
{
.......
}
.......
function ioErrorHandler(e:event):void
{
.......
}