As a clarification, the TypeErrors are being thrown by setMap on the restrooms layer, but the buildings layer is what induces the bug.
On Jun 18, 3:10 pm, Matthew C <[email protected]> wrote: > I have created a map that allows the user to toggle KML layers on and > off. In order to keep them in a specific stacking order, I've used > code that will hide and show all of the layers in the order I want > them whenever a layer is turned on (turning layers off doesn't change > the stacking order, but turning a layer on puts it in the front > without my code that then puts new layers in the front). > > The code works fine in Chrome and Firefox and (I believe) in IE. But > in Safari (at least on a Mac), toggling a particular layer causes the > browser to report: > TypeError: Result of expression 'd' [undefined] is not an object > and proceed to draw the map. The second time I toggle the layer (and > every time thereafter), I get > TypeError: Result of expression 'a.ib' [undefined] is not an object. > > These TypeErrors are being thrown by the 'buildings' layer. > > My map implementation is > athttp://foothill-web-gis.googlecode.com/svn/trunk/webgis/fhwebmapdemo.... > . To reproduce the error, unfold the 'Layers' tab (top right) and turn > buildings off and on again. Leave the other layers as is; turning any > layer off causes the bug to go away. > > When you toggle the buildings layer on, here is what happens > (confirmed with the debugger in Chrome and the one in Safari): > this.layers.buildings.setMap(map) > " rooms3 > " restrooms > " elevators > " rooms2 > " restrooms > " elevators > " rooms3 > " restrooms > Error occurs here, preventing the rest of the sequence from occurring > (and, since setMap is asynchronous, it also prevents rooms3 from > displaying, as well as the second time around on elevators) > " elevators > done. > > The reason that restrooms and elevators are shown three times is that > the code doesn't have any way of knowing whether the calling function > is going to call it for rooms3, rooms2 and rooms1, or just rooms3, &c. > > The brain dump of how the layer stacking manager works is > athttp://foothill-web-gis.googlecode.com/svn/docs/layerStacking.txt. > > Thanks for any help, I really appreciate it. > Matt -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
