Levan Anderson
Levan Anderson

Reputation: 77

as3 dispatching events

when dispatching events in as3 I always have to extend class from sprite, or movieclip, but when I don't have display objects I don't wont to extend to sprite or movieclip. What is the most light class that I can extend, i mean no display object, and stile do use event dispatching?

Upvotes: 1

Views: 238

Answers (1)

shanethehat
shanethehat

Reputation: 15580

flash.events.EventDispatcher

EventDispatcher is the base class for all classes in AS3 that dispatch events. The easiest way for you to create a class that can dispatch events is to have your class extend EventDispatcher.

Sometimes however, that is not possible. If, for example, your class already extends a different class that is not descended from EventDispatcher, then you are stuck, because classes and only extend one superclass. The solution in this case is to make your class implement IEventDispatcher, and hand off the functionality of the required methods to an instance of EventDispatcher instead.

Upvotes: 1

Related Questions