Alex, here's what I tried: COMPILE::JS public class EventDispatcher extends goog.events.EventTarget implements IEventDispatcher { private var _target:IEventDispatcher; public function EventDispatcher(target:IEventDispatcher = null) { _target = target || this; }
public function hasEventListener(type:String):Boolean { return goog.events.hasListener(this, type); } override public function dispatchEvent(event:Object):Boolean { try { //we get quite a few string events here, "initialize" etc //so this general approach doesn't work: //event.target = _target; if (event is String) event = new Event(event as String,_target); else if (event.target != undefined) event.target = _target; return super.dispatchEvent(event); } catch (e:Error) { if (e.name != "stopImmediatePropagation") throw e; } return false; } } This seemed to work in js-debug, but I saw issues (see below) in some code in release mode, I didn't get to the bottom of that yet, sorry. I had not seen these with the original version: Uncaught TypeError: this.dispatchEvent is not a function On Thu, Sep 1, 2016 at 6:20 PM, Greg Dove <greg.d...@gmail.com> wrote: > yeah, it's 6pm here now, I am breaking for dinner. Will try this evening > and report back here > > On Thu, Sep 1, 2016 at 6:16 PM, Alex Harui <aha...@adobe.com> wrote: > >> >> >> On 8/31/16, 11:03 PM, "Greg Dove" <greg.d...@gmail.com> wrote: >> >> >In looking at the Google code, it appears that all we need to do in our >> >EventDispatcher.dispatchEvent override is set the event.target on the >> >event object to the wrapper. Do you see the same thing? >> > >> >I didn't try that, but yes I do see that now. well spotted! :) >> >that sounds good if all our events are descendants of goog.events.Event >> >> Do you have time to try it? I can try tomorrow (for me) if you don't have >> time. >> >> Thanks, >> -Alex >> >> >