Information Window
View live sample | Download as a zip file
Description
Use "drawPt(showTip)" to show an info window after a feature is selected. To use it, you have to download and include "drawPt.as".
How To Use
1. Download and include "drawPt.as".
2. Copy and modify the codes below.
Code
                                <?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
			   xmlns:s="library://ns.adobe.com/flex/spark"
			   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
			   xmlns:sgw="library://www.supergeotek.com/sgw"
			   initialize="application1_initializeHandler(event)">
	
	<fx:Script>
 
		<![CDATA[
			import Core.ICommand;
			import Core.IDisplayTransformation;
			import Core.ITool;
			import Geometry.Envelope;
			import MapLayer.MapCachedLayer;
			import MapLayer.MapLayer;
			import MapLayer.MapLayerEvents;
			import MapLayer.MapLayerInner;
			import Tool.*;
			import Tool.FullExtentTool;
			import Tool.Identify;
			import Tool.MapZoomStep;
			import Tool.PanTool;
			import Tool.ZoomLastTool;
			import Tool.ZoomTool;
			import mx.events.FlexEvent;
			
			protected function application1_initializeHandler(event:FlexEvent):void
				
			{
				var pLyr:MapLayer = new MapLayer();
				pLyr.addEventListener(MapLayerEvents.LOADED, maptilelayer1_LoadedHandler);
				pLyr.Name = "SGW";
				pLyr.Title = "SGW";
				pLyr.ResourcePath="http://sgs.supergeo.com.tw/sfs_infow1/Agent.aspx";
				
			}
			
			protected function maptilelayer1_LoadedHandler(vEvent:MapLayerEvents):void
			{
				var pStep:MapZoomStep= new MapZoomStep(oMapBase);
				var pLyr:MapLayer = vEvent.currentTarget as MapLayer;
				
				var pExt:Envelope = pLyr.Extent;
				oMapBase.AddLayer(pLyr);
				
				var pTrans:IDisplayTransformation = new LevelTransformation(256 / (pExt.Right - pExt.Left), 0, 15);
				oMapBase.Transformation = pTrans as IDisplayTransformation;
				
				oToolbar.AddTool(new ToolbarItem(new ZoomTool(0), "Images/Button/Zoom_In.png", "Zoom In"));
				oToolbar.AddTool(new ToolbarItem(new ZoomTool(1), "Images/Button/Zoom_Out.png", "Zoom Out"));
				oToolbar.AddTool(new ToolbarItem(new PanTool(), "Images/Button/Move.png", "Pan"));
				oToolbar.AddTool(new ToolbarItem(new FullExtentTool(), "Images/Button/FullExtent.png", "Full Extent"));
				oToolbar.AddTool(new ToolbarItem(new ZoomLastTool(pStep, true), "Images/Button/Zoom_Prev.png", "Prev Extent"));
				oToolbar.AddTool(new ToolbarItem(new ZoomLastTool(pStep, false), "Images/Button/Zoom_Next.png", "Next Extent"));
				
				var pExt1:Envelope = new Envelope(-16.998393, 33.774100, 46.929019, -32.278776) as Envelope;
				oMapBase.ZoomMapTo(pExt1);
				
				oMapBase.RefreshMap(true);
				
				var pTl1:PanTool = new PanTool(true, true);
				oMapBase.SelectMapTool(pTl1);
			}
			protected function pQuery(vEvent:Tool.Identify):void{
			}
			protected function button1_clickHandler(event:MouseEvent):void
			{
				oMapBase.SelectMapTool(new drawPt(showTip) as ITool);
			}
			
			protected function infoWindow():void{
			}
			protected function closeShowTipEvent(event:MouseEvent):void{                
				showTip.visible = false;
			}
			
		]]>
		
	</fx:Script>
	
	<fx:Declarations>
		
	</fx:Declarations>
	
	<sgw:MapControl id="oMapBase" width="100%" height="100%">

	</sgw:MapControl>
	<sgw:ToolbarControl x="17" y="80" id="oToolbar" Map="{oMapBase}">
	</sgw:ToolbarControl>
	<s:Button x="200" y="80" label="Info Window" width="100" height="28" click="button1_clickHandler(event)"/>
	<s:BorderContainer id="showTip" visible="false" x="9" y="13" width="176" height="83"   backgroundColor="#FFFFFF" borderWeight="2" cornerRadius="5" alpha="0.85">
		<s:VGroup x="4" y="22" width="142">
			
		</s:VGroup>           
	</s:BorderContainer>
	<s:Label x="17" y="13" text="SuperGIS Server Flex Website Sample&#xd;--- Info window" fontWeight="bold" fontSize="30" color="#016B09" backgroundColor="#9ACD32" backgroundAlpha="0.7"/>
</s:Application>