<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:fx="http://ns.adobe.com/mxml/2009"
		   xmlns:s="library://ns.adobe.com/flex/spark"
		   xmlns:mx="library://ns.adobe.com/flex/mx"
		   backgroundColor="#DFF1F9" cornerRadius="7"
		   initialize="init(event)">
	<fx:Script>
		<![CDATA[
			import com.xt.hb.utils.MapUtils;
			
			import mx.controls.Label;
			import mx.events.FlexEvent;
			protected function init(event:FlexEvent):void{
				setInfoWindowStyle();
				var label:Label = null;
				if(null != infoArr && infoArr.length > 0){
					for each(var info:String in infoArr){
						label = new Label();
						label.text=info;
						infoBox.addChild(label);
					}
				} else {
					label = new Label();
					infoBox.addChild(label);
				}
				setInfoWindowStyle();
			}
			public var infoArr:Array;
			public var plusX:Number = 1;
			public var plusY:Number = -1;
			/**
			 * 设置infoWindow样式
			 */
			public function setInfoWindowStyle():void{
//				MapUtils.map.infoWindow.label = "标题？？";
//				MapUtils.map.infoWindow.setStyle("backgroundColor",0xDFF1F9);
//				MapUtils.map.infoWindow.setStyle("borderStyle","solid");
//				MapUtils.map.infoWindow.setStyle("borderColor",0xA2F1F9);
				MapUtils.map.infoWindow.labelVisible = false;
				MapUtils.map.infoWindow.closeButtonVisible = false;
			}
			/**
			 * 弹出
			 */
			public function showInfoWindow(arr:Array, e:MouseEvent):void{
				this.percentWidth = 100;
				MapUtils.map.infoWindow.percentWidth = 100;
				show(arr, e);
			}
			/**
			 * 自定义宽度弹出
			 */
			public function showInfoWindow1(arr:Array, e:MouseEvent, width:Number):void{
				MapUtils.map.infoWindow.width = width;
				this.width = width;
				show(arr, e);
			}
			
			/**
			 * 自定义宽度弹出
			 */
			public function show(arr:Array, e:MouseEvent):void{
				infoArr = arr;
				MapUtils.map.infoWindow.content = this;
				MapUtils.map.infoWindow.show(MapUtils.map.toMapFromStage(
					e.stageX + plusX, e.stageY + plusY));
			} 
		]]>
	</fx:Script>
	<mx:VBox backgroundColor="0xDFF1F9" id="infoBox" horizontalGap="0" verticalGap="0">
	</mx:VBox>
</mx:Canvas> 
