From: xavi t. <th...@ya...> - 2000-11-20 12:42:27
|
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/ |
From: Eytan H. <ey...@tr...> - 2000-11-20 17:18:35
|
If I had to guess I would say it is because of the Event Bubbling in NS6. The problem with your fix is that it is very unstable. Waiting 10 ms. That could cause problems in the future. I will look in to it. |
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 |
From: Rob R. <ro...@ma...> - 2000-11-21 21:20:19
|
Okay I'm building a menuing system using DynAPI, everything is working great on window ie v5 and netscape v4, and mac netscape v4 but in testing the thing out on mac ie 5 I've run into an annoying problem. The menu is being built on the fly, I'm never sure how many lines of text will be in a menu entry because of the length of some item we wrap the text. Also the system is such that images can be substituted in for HTML text and it will work just fine, again image size from entry to entry may vary. So I've built the system such that each menu item is its own layer and as the content is added to the layer the height of the layer is determined using "getContentHeight()" and this value is tracked by the menu manager so it can work out where to position then next menu item. The problem I've come across is this on the Mac IE 5 getContentHeight returns as "NaN" a little exploration and it turns out that "this.elm.scrollHeight" which the getContentHeight() call uses returns "undefined". Other properties of the "elm", such a visibility return just fine. When I create a layer the standard way right in the HTML and query the scrollHeight Mac IE 5 returns the correct value. It may be a matter of timing as when I query the scrollHeight, but I do have the layer existing via the addChild call and as I said it works on all the other browser platform setups so I'm stumped. Any ideas? Thanks, Rob Romanek |
From: Simon D. M. <di...@bi...> - 2000-11-24 15:18:19
|
> The problem I've come across is this on the Mac IE 5 getContentHeight > returns as "NaN" a little exploration and it turns out that > "this.elm.scrollHeight" which the getContentHeight() call uses returns > "undefined". Other properties of the "elm", such a visibility return just > fine. When I create a layer the standard way right in the HTML > and query the > scrollHeight Mac IE 5 returns the correct value. It may be a matter of > timing as when I query the scrollHeight, but I do have the layer existing > via the addChild call and as I said it works on all the other browser > platform setups so I'm stumped. Any ideas? Have you fixed this problem with .elm.scrollHeight yet? If not, you say that you have wrapping in the layer so I guess you may have tables in them. If so you could get the height of the tables instead. Something like: MenuOption.prototype.MenuOptiongetContentHeight=DynLayer.prototype.getConten tHeight MenuOption.prototype.getContentHeight=function(){ if(is.ie)return this.elm.children[0].clientHeight else return MenuOptiongetContentHeight() } Maybe this would fix your problem, if not DynAPI's. I found that on IE5/Win, if you reduce the size of the content of a layer, .elm.scrollHeight doesn't register it. Don't know about other versions/platforms. Maybe you could try .elm.offsetHeight - it doesn't work any better than .elm.scrollHeight on IE5/Win but it works differently on a Mac. > Okay I'm building a menuing system using DynAPI, everything is > working great > on window ie v5 and netscape v4, and mac netscape v4 but in testing the > thing out on mac ie 5 I've run into an annoying problem. > > The menu is being built on the fly, I'm never sure how many lines of text > will be in a menu entry because of the length of some item we > wrap the text. > Also the system is such that images can be substituted in for > HTML text and > it will work just fine, again image size from entry to entry may vary. So > I've built the system such that each menu item is its own layer and as the > content is added to the layer the height of the layer is determined using > "getContentHeight()" and this value is tracked by the menu > manager so it can > work out where to position then next menu item. > |