implements IEventDispatcher, for when you can't subclass EventDispatcher directly
✓ Published0🌍 Public
RRandomEtc
Last edited Aug 10, 2010
Created on Aug 10, 2010
This example shows how to implement the Flash `IEventDispatcher` interface in a custom class when subclassing `EventDispatcher` directly is not possible. It demonstrates a composition pattern where the class creates an internal `EventDispatcher` instance, passing itself as the target in the constructor. All required interface methods—`addEventListener`, `removeEventListener`, `dispatchEvent`, `hasEventListener`, and `willTrigger`—are delegated to this private `dispatcher` object, forwarding calls with the appropriate parameters. The code uses ActionScript 3’s `flash.events.IEventDispatcher` and `flash.events.EventDispatcher` APIs, with no external data or rendering involved.
AI-generated description