Sorry I missed this email before, but I don’t think this will work with full minification.
> On Mar 9, 2022, at 3:37 AM, Greg Dove <greg.d...@gmail.com> wrote: > > In the absence of anything suggesting otherwise, I have addressed this in a > commit today. > I had toyed with the idea of trying to change all the dispatchEvent(event) > sites that are redispatching to dispatchEvent(event.cloneEvent()), but that > seems wrong because it is less reliable in terms and maintainability and > also still means that the EventDispatcher dispatchEvent method is behaving > differently to how it should behave. > > > > > > On Tue, Mar 1, 2022 at 11:31 AM Greg Dove <greg.d...@gmail.com> wrote: > >> >> 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 <greg.d...@gmail.com> 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 >>> >>> >>>