When using an outside actionscript object (in this example a
SharedObject) I'm getting some odd results when I try to attach
handlers to events on the object.

If I use the code:

 <event name="onSync"/>
 <handler name="oninit">
 var t = this;
 this._so.onSync = function(evtObj) {
         t._onStatus(evtObj);
     };
 </handler>

and in the attaching class:

 this._onSyncDel = new LzDelegate(this, "syncHandler", this._so, "onSync");

everything works fine and this._so.onSync = an LzEvent object. If,
however, I use this:

 <event name="onSync"/>
 <handler name="oninit">
   this._so.onSync = this._onStatus;
 </handler>

and

the same in the attaching class this._so.onSync = a Function object
pointing to the evet exposings _onStatus method. Then if I change the
code to:

 <event name="onSync"/>
 <handler name="oninit">
   this._onSyncDel = new LzDelegate(this, "_onStatus", this._so, "onSync");
 </handler>

The event simply doesn't fire. While it took me awhile to figure out
the fix I demonstrated in the first example, shouldn't at least the
first two function the same? It appears calling this._so.onSync =
this._onStatus is actually overwriting this.onSync instead of
this._so.onSync, any ideas?

Cheers,
 Tyler

Reply via email to