# IEVentDispatcher compile error

**URL:** <https://forum.kirupa.com/t/ieventdispatcher-compile-error/255709>\
**Category:** flash\
**Created:** [March 26, 2008, 5:35am UTC](https://forum.kirupa.com/t/ieventdispatcher-compile-error/255709 "2008-03-26T05:35:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![delta3d](https://avatars.discourse-cdn.com/v4/letter/d/e36b37/32.png) [@delta3d](https://forum.kirupa.com/u/delta3d)\
**Post date:** [March 26, 2008, 5:35am UTC](https://forum.kirupa.com/t/ieventdispatcher-compile-error/255709/1 "2008-03-26T05:35:29Z")

</div>

Dear All,

I encounter one problem when use IEVentDispatcher/EVentDispatcher, it gives out below error:  
[COLOR=red]com\icutommy\events\IEventDispatcher.as: the third line: class definition not allowed in this statement, \_global.com.icutommy.events.IEventDispatcher = function () [/COLOR]

[COLOR=black]Woud you some one give me some advise, thanks a million![/COLOR]

**The code of IEVentDispatcher:**

```auto
class com.icutommy.events.IEventDispatcher 
{ 
_global.com.icutommy.events.IEventDispatcher = function () 
{ 
}; 
} // End of Class 

```

**The code of EVentDispatcher:**

```auto
class com.icutommy.events.EventDispatcher implements com.icutommy.events.IEventDispatcher
{
   var _ls;
   function EventDispatcher()
   {
     this.init();
   } // End of the function
   function addEventListener(e, l, f)
   {
     for (var _loc2 in _ls)
     {
       if (_ls[_loc2].e == e && _ls[_loc2].l == l)
        {
         return (false);
        } // end if
     } // end of for...in
     _ls.push({e: e, l: l, f: f});
     return (true);
    } // End of the function
  
   function removeEventListener(e, l)
   {
     for (var _loc2 = 0; _loc2 < _ls.length; ++_loc2) 
     {
       if (_ls[_loc2].e == e && _ls[_loc2].l == l)
       {
        _ls.splice(_loc2, 1);
        return (true);
       } // end if
      } // end of for
    return (false);
    } // End of the function
   function dispatchEvent(ev)
   {
     for (var _loc3 in _ls)
     {
      if (_ls[_loc3].e == ev.type)
      {
        if (_ls[_loc3].f)
        {
         _ls[_loc3].f.apply(_ls[_loc3].l, [ev]);
         continue;
        } // end if
       _ls[_loc3].l[ev.type](ev);
      } // end if
     } // end of for...in
   } // End of the function
  function clear()
  {
   _ls = new Array();
   } // End of the function
  function destroy() 
  {
    this.clear();
    delete this._ls;
   } // End of the function
  
  function init()
  {
   _ls = new Array();
  } // End of the function
} // End of Class

```

[COLOR=#ff0000][/COLOR]  
[COLOR=#ff0000][/COLOR]
