Sorry I sent that last message accidentally before finishing it...
To achieve the same thing in Royale, we need to make the following change
in org.apache.royale.events.EventDispatcher:
at location [1]
else if ("target" in event1) {
if (event1.target && "cloneEvent" in event1) {
event1 = event1.cloneEvent();
}
event1.target = _dispatcher;
}
Can anyone see issues with addressing this? There are quite a few cases
where this is needed in the emulation code.
1.
https://github.com/apache/royale-asjs/blob/develop/frameworks/projects/Core/src/main/royale/org/apache/royale/events/EventDispatcher.as#L87
On Tue, Mar 1, 2022 at 11:28 AM Greg Dove <[email protected]> wrote:
>
> for any example that listens and re-dispatches an event in Royale, eg:
>
>
> public function collectionChangeHandler(event:CollectionEvent):void{
> ... other code ...
> else if (ce.kind == CollectionEventKind.RESET)
> {
> ... other code ...
> dispatchEvent(event);
> }
> else if ... other code ...
> }
>
> Currently in AVM this will work as it did before. But in Royale it does
> not, it will mutate the original event by reseting the target to the
> current dispatcher.
> This is because the AVM EventDispatcher (I assume) calls the clone()
> method on the event, redispatching a new instance from the dispatcher.
>
> To achieve the same thing in Royale, we need to make the following change
> in org.apache.royale.events.EventDispatcher:
>
> at location [1]
>
> else if ("target" in event1) {
> if (event1.target && "cloneEvent" in event1) {
> event1 = event1.cloneEvent();
> }
>
> }
>
>
>
>
>
>
> 1.
> https://github.com/apache/royale-asjs/blob/develop/frameworks/projects/Core/src/main/royale/org/apache/royale/events/EventDispatcher.as#L87
>
>
>