delta3d
March 26th, 2008, 02:35 AM
Dear All,
I encounter one problem when use IEVentDispatcher/EVentDispatcher, it gives out below error:
com\icutommy\events\IEventDispatcher.as: the third line: class definition not allowed in this statement, _global.com.icutommy.events.IEventDispatcher = function ()
Woud you some one give me some advise, thanks a million!
The code of IEVentDispatcher:
class com.icutommy.events.IEventDispatcher
{
_global.com.icutommy.events.IEventDispatcher = function ()
{
};
} // End of Class
The code of EVentDispatcher:
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
I encounter one problem when use IEVentDispatcher/EVentDispatcher, it gives out below error:
com\icutommy\events\IEventDispatcher.as: the third line: class definition not allowed in this statement, _global.com.icutommy.events.IEventDispatcher = function ()
Woud you some one give me some advise, thanks a million!
The code of IEVentDispatcher:
class com.icutommy.events.IEventDispatcher
{
_global.com.icutommy.events.IEventDispatcher = function ()
{
};
} // End of Class
The code of EVentDispatcher:
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