方法一:
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
{
  .......
}
posted on 2009-08-28 13:30  sungo  阅读(394)  评论(0编辑  收藏  举报