用的是arcgisserver for flex 做电子地图开发
遇到一个问题,请教各位大虾:
先从后台数据库查询,得到n个几何对象,包括点,线 等
再这把查询到得对象,变为graphic ,添加到一个layer里面,通过map.addLayer(layer);在地图上显示
graphic如果是POINT的话,它的SYMBOL是一个PictureMarkerSymbol,代码如下:
- Java code
var graphic:Graphic = new Graphic(result.feature.geometry); if(result.feature.geometry.type.toString() == "esriGeometryPoint"){ graphic.symbol = eps.getPicUrl( result.layerName, result.feature.attributes["分类"], "0", result.feature.attributes["ANGLE"]); }else{ graphic.symbol = symbolM.getFeatureSymbol(graphic.geometry.type.toString()); } var obj:Object = { layername:result.layerName, subtype:result.feature.attributes["分类"], angle:result.feature.attributes["ANGLE"], objectid:result.feature.attributes.OBJECTID, type:result.feature.geometry.type.toString() }; graphic.attributes = obj; graphic.toolTip = result.feature.attributes["设备编码"]; graphic.addEventListener(MouseEvent.MOUSE_OVER, mouseOver); graphic.addEventListener(MouseEvent.MOUSE_OUT, mouseOut); graphic.addEventListener(MouseEvent.CLICK, function(evt:MouseEvent):void{ var g:Graphic = evt.currentTarget as Graphic; queryUtils.getAttributeByID(g.attributes.layername, g.attributes.objectid, hbBaseMapLayer, onRusult ); }); featureServerLayer.add(graphic); function mouseOver(evt:MouseEvent):void{ var g:Graphic = evt.currentTarget as Graphic; if(g.geometry.type.toString() == "esriGeometryPoint"){ var object:Object = g.attributes; g.symbol = eps.getPicUrl(object.layername, object.subtype, "1", object.angle); }else{ g.symbol = symbolM.getSelectSymbol(g.attributes.type); } } function mouseOut(evt:MouseEvent):void{ var g:Graphic = evt.currentTarget as Graphic; if(g.geometry.type.toString() == "esriGeometryPoint"){ var object:Object = g.attributes; g.symbol = eps.getPicUrl(object.layername, object.subtype, "0", object.angle); }else{ g.symbol = symbolM.getFeatureSymbol(g.attributes.type); } }
问题是:当鼠标移动到graphic(POINT)的symbol上,图片总是一直在切换,不是只切换一次
------解决方案--------------------
随便看了下,貌似没看出问题来,我一直都是这样写的。