Mouse Over on KML layer using JavaScript API

Discussion created by FrankFlynn on Apr 22, 2013

I cannot get a mouse over event to work when I pass the mouse over a KMLlayer.  I have a basic piece of code that works with a graphics layer, but cannot get the KML layer recognized.  Anyone have any thoughts ?  I attached the code that works for a graphics layer.  Then below that I attached what we started trying for the KML layer.  Thank you.

            var graphicLayerIds = map.graphicsLayerIds;
            var layer1 = map.getLayer(graphicLayerIds[1]);
            var layer2 = map.getLayer(graphicLayerIds[2]);
            var layer3 = map.getLayer(graphicLayerIds[3]);
            var layer4 = map.getLayer(graphicLayerIds[4]);

            dojo.connect(layer1, "onMouseOver", myMouseOver);
            dojo.connect(layer2, "onMouseOver", myMouseOver);
            dojo.connect(layer3, "onMouseOver", myMouseOver);
            dojo.connect(layer4, "onMouseOver", myMouseOver);

            dojo.connect(layer1, "onMouseOut", myMouseOut);
            dojo.connect(layer2, "onMouseOut", myMouseOut);
            dojo.connect(layer3, "onMouseOut", myMouseOut);
            dojo.connect(layer4, "onMouseOut", myMouseOut);

        function myMouseOver() {

        function myMouseOut() {

Adding KML Layers:
            var kmlUrl = getMapUrl(1);
            var kml = new esri.layers.KMLLayer(kmlUrl);

            kmlUrl = getMapUrl(2);
            kml = new esri.layers.KMLLayer(kmlUrl);

            var layerIds = map.layerIds;
            var kmlLayer1 = map.getLayer(layerIds[1]);
            var kmlLayer2 = map.getLayer(layerIds[2]);