flex 读取xml 实现点的自定义位置高亮显示和闪烁

下面的代码实现基本的地图。用esri公司提供的为例 第2个url自己换个喜欢的图
<mx:Canvas id="canvas" width="100%" height="100%" borderStyle="solid" borderThickness="2" borderColor="#439AD7">
<esri:Map id="map" logoVisible="false" panArrowsVisible="true">
<esri:ArcGISDynamicMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/NPS_Physical_World_2D/MapServer"/>
<esri:ArcGISDynamicMapServiceLayer id = "map1" url="http://server.arcgisonline.com/ArcGIS/rest/services/NPS_Physical_World_2D/MapServer"/>
</esri:ArcGISDynamicMapServiceLayer>
</esri:Map>
</mx:Canvas>

下面的代码是 读取xml是的 url连接 和xml里面的第一个title的显示
<mx:HTTPService id="myService" url="*.xml" result="resultHandler(event)" />
<mx:Text id="txt" text="{myData.getItemAt(0).title}" />

下面是script的完整代码 实现点的自定义位置高亮显示和闪烁
private var graphicslayer:GraphicsLayer=new GraphicsLayer();
public function init():void
{
myService.send();
map.addLayer(graphicslayer);
this.map.addEventListener(ZoomEvent.ZOOM_END,mouseZ);

var t:Timer = new Timer( 500,20 );
t.addEventListener( TimerEvent.TIMER, onTimer );
t.start();
}
public function mouseZ(event:ZoomEvent):void
{
if(this.map1.visible == false)
{
this.map1.visible =true;
var mapPoint:MapPoint =new MapPoint();
mapPoint.x =121.123123;
mapPoint.y =31.12341;
this.map.centerAt(mapPoint);
this.map.scale = 1800000;
}
}
public function onTimer(event:Event):void
{
graphicslayer.clear();
var mapPoint:MapPoint =new MapPoint();
mapPoint.x =121.123123;
mapPoint.y =31.12341;
var simpleMarkerS:SimpleMarkerSymbol=new SimpleMarkerSymbol();
simpleMarkerS.color=0x00FF00;
simpleMarkerS.size =10;
// circle园 triangle三角 square方形 diamond菱形 cross十字 X
simpleMarkerS.style ="circle";
var graphics:Graphic=new Graphic();
graphics.symbol =simpleMarkerS;
graphics.geometry =mapPoint;
graphicslayer.add(graphics);

}
[Bindable]
private var myData:ArrayCollection;

private function resultHandler(event:ResultEvent):void {
myData = event.result.books.item;

}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值