IMO, the “right” way to fix this is by dispatching events from the 
flexjs_wrapper and implement event bubbling up the FlexJS element chain.

Yishay did not mention them, but we were having a whole slew of problems 
related to events:


1. Event targets being lost (which he mentioned here)
2. Fixing that seems to mess up bubbling. (again)
3. clone() and cloneEvent() is a bit weird. You cannot dispatch cloneEvent() 
directly without casting it first (because it’s the Flash EventDispatcher which 
does the dispatching) and you cannot override clone() using a Flex event 
because it’s an incompatible override.
4. BrowserEvents vs. MouseEvent We were actually kind of confused by 
MouseEvent, because in the Browser, only BrowserEvents seem to be used. What’s 
the point of MouseEvents?
5. EventDispatcher took a Flash event even though we really need a Flex event. 
See # 3.
6. EventDispatcher cannot take an IFlexEvent. This kind of defeats the point of 
have an IFlexEvent in the first place.
7. BrowserEvent was missing localX and localY (maybe fixed)
8. I really think that MouseEvent should probably subclass event, but it can’t 
because it subclasses Flash MouseEvent. It it wrapped the events, this problem 
would be solved.

To me, all this points to the fact that we should have a Flex event bus which 
would be completely cross-platform and wrap browser and Flash events.



On Aug 18, 2016, at 10:05 AM, Alex Harui <[email protected]> wrote:

> 
> 
> On 8/17/16, 11:25 PM, "yishayw" <[email protected]> wrote:
> 
>> If I listen on a click event on the application I expect to get all click
>> events bubbled up from contained elements. That works, however the target
>> is
>> the application rather than the element that was clicked on. This is due
>> to
>> ElementWrapper.forwarder() re-dispatching the event, where the
>> ElementWrapper is the application. Is this by design?
> 
> Well yes, for events dispatched from the wrapped element, but you are
> correct that it won't work for bubbled events.  There is no way to set the
> target of an event in Flash.  We might have to build our own queue of
> listeners and call them directly, but even then, the target will be a
> wrapped element and not its wrapper.
> 
> This might be an issue that kills the plan of wrapping Flash
> DisplayObjects.  We'll see if someone comes up with a "easy" way of
> getting it to work.  I'll ponder it while I'm sleeping.
> 
> -Alex
> 

Reply via email to