From: Scott A. L. <sc...@sc...> - 2000-11-20 17:44:36
|
This behavior is something I am currently trying to understand. Netscape 6 and Mozilla use a DOM event model. In this model, the event begins at the window (the top-most object) and travels inward towards the target (for example, the text of a link that was clicked). Once the event reaches the intended target, the event then does an about-face and travels backward until it reaches the window. So there are three seperate states of the event: traveling inward (event capture), reaching the target, and traveling back outward (event bubbling). This is called the Event Phase, and is exposed as a property on the event object itself (I *think* it's e.eventPhase). NS6/Mozilla allows you to choose the phase in which event handlers can fire, based on your needs. For example, you can add an onmousedown handler that only fires when the event is in the bubble (outward) phase. Seeing as the DynAPI uses it's own event model to handle events, it's entirely possible that the natural capture and bubble phases are triggering DynAPI eventlisteners more than once. The DynAPI model makes no distinction as to which direction the natural event is travelling, as the DynAPI model forces bubble with it's own DynEvent objects. Your temporary fix may be allowing enough time for the natural event to flush out. This is only my theory, as I don't have a full grasp on the NS6 event model yet. scottandrew "xavi t." wrote: > > Hi guys, > > Dows anyone knows why Netscape6 trigger each mouse > event more than one time, I mean: if you do a click > over a layer with a EventListener the DynLayer will > receive two or three events of the same type. > > I have been testing it, and I can't resolve the > problem. I have been looking inside the DynAPI library > (dynlayer.js and events.js) but I can't find any bug. > > The only way I found to avoid this 'bug' is doing > something like this inside the onmousexxxx function: > > (the var way is initially '1') > > myEventListener.onmousedown = function (e) { > me = e.getTarget() > if (me.way==1) { > me.way = 0; > /* my code */ > > // after 10 ms we will ready to listen > another event of this kind > setTimeout('me.way=1', 10) > } else { > /*do nothing cause this event has been done*/ > } > } > > Thanks in advance, > > Javier Tejero > Barcelona > (Catalonia) > SPAIN > > __________________________________________________ > Do You Yahoo!? > Yahoo! Calendar - Get organized for the holidays! > http://calendar.yahoo.com/ > _______________________________________________ > Dynapi-Dev mailing list > Dyn...@li... > http://lists.sourceforge.net/mailman/listinfo/dynapi-dev -- scott andrew lepera ----------------------------------- web stuff: www.scottandrew.com music stuff: www.walkingbirds.com |