[Arp] Event implementation clarification
Chris Velevitch
chris.velevitch at gmail.com
Sun May 1 06:09:18 PDT 2005
I want to clarify how Arp implements of event handling.
All views extends ArpForm. ArpForm extends MovieClip. ArpForm defined
4 empty methods:-
addEventListener
dispatchEvent
removeEventListener
dispatchQueue
which correspond to methods in the class EventDispatcher. In the
ArpForm constructor, there is this call:-
EventDispatcher.initialize(this);
This call redefines the 4 methods to refer to the same methods of the
class EventDispatcher (a.k.a mixins to fix the multiple inheritance
shortcomings of AS2) which is a singleton so there's only instance.
If viewA adds an event listener for eventX and viewB also adds an
event listener for eventX, the end result is: viewA has an event queue
for eventX (viewA["__q_eventX"]) and viewB has an event queue ofr
eventX (viewB["__q_eventX"]).
Because each view has a reference to the dispatchEvent method and each
view as separate event queues, you must choose the view to call
dispatchEvent on.
Now, my question is: is this intentional, the multiple queues for the
same event? Before I looked into this more deeply, I thought there was
only one queue per event type. I can see that multiple event queues
would be fast to find and execute events it there are an enormous
number of events throughout the whole application. But the downside
being, an extra level of interview dependencies if you need multiple
views act on the same event. Dispatching eventX to viewA means that
viewA would have to dispatch eventX to viewB and vice versa.
Am I making sense or have I read this wrong?
More information about the Arp
mailing list