Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="utf-8"?>
- <!--
- ////////////////////////////////////////////////////////////////////////////////
- //
- // Copyright (c) 2010 ESRI
- //
- // All rights reserved under the copyright laws of the United States.
- // You may freely redistribute and use this software, with or
- // without modification, provided you include the original copyright
- // and use restrictions. See use restrictions in the file:
- // <install location>/License.txt
- //
- ////////////////////////////////////////////////////////////////////////////////
- -->
- <viewer:BaseWidget xmlns:esri="http://www.esri.com/2008/ags"
- xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:s="library://ns.adobe.com/flex/spark"
- xmlns:mx="library://ns.adobe.com/flex/mx"
- xmlns:mxeffects="com.adobe.ac.mxeffects.*"
- xmlns:flash="flash.text.*"
- xmlns:viewer="com.esri.viewer.*"
- xmlns:widgets="widgets.*"
- x="600" y="300"
- initialize="basewidget1_initializeHandler(event)"
- >
- <fx:Script>
- <![CDATA[
- import com.esri.ags.Graphic;
- import com.esri.ags.geometry.Geometry;
- import com.esri.ags.geometry.MapPoint;
- import com.esri.ags.layers.GraphicsLayer;
- import com.esri.ags.symbols.*;
- import mx.controls.Alert;
- import mx.events.FlexEvent;
- import spark.components.Button;
- [Bindable]
- private var graphicsLayer:GraphicsLayer;
- private var myGraphic:Graphic = new Graphic();
- private var geom:Geometry = new Geometry();
- var mycs:CustomSymbol;
- protected function basewidget1_initializeHandler(event:FlexEvent):void
- {
- // TODO Auto-generated method stub
- graphicsLayer = new GraphicsLayer();
- graphicsLayer.name = "testLayer";
- map.addLayer(graphicsLayer);
- map.addEventListener(MouseEvent.CLICK,mapMouseClickhandler);
- }
- private function mapMouseClickhandler(event:MouseEvent):void {
- const mapPoint:MapPoint = map.toMapFromStage(event.stageX, event.stageY);
- mapPoint.spatialReference = map.spatialReference;
- geom= mapPoint;
- mycs= new CustomSymbol();
- myGraphic = new Graphic(geom,mycs);
- graphicsLayer.add(myGraphic);
- }
- ]]>
- </fx:Script>
- <fx:Declarations>
- </fx:Declarations>
- <viewer:WidgetTemplate id="wTemplate"
- width="420" height="300"
- minHeight="300"
- minWidth="420">
- <s:Label text="click on the map" />
- </viewer:WidgetTemplate>
- </viewer:BaseWidget>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement