protected function pointsXML_resultHandler(event:ResultEvent):void { var gArr:Array = []; var myGraphics:Array = []; var x:XML = XML(event.result); pntList = x..entry; for (var i:int = 0; i < pntList.length(); i++){ var latlong:Array = pntList.point.split(" "); var attrib:Object = pntList.name; var r:Object = pntList.region; var s:Object = pntList.summary; var myPoint:Geometry = new MapPoint(latlong[1], latlong[0], new SpatialReference(4326)); var coordGraphic:Graphic = new Graphic(myPoint,null,attrib); gArr.push(myPoint); myGraphics.push(coordGraphic); } var outSR:SpatialReference = new SpatialReference(3857); geometryService.project(gArr, outSR, new AsyncResponder(projectCompleteHandler, null, myGraphics)); }
Solved! Go to Solution.
protected function pointsXML_resultHandler(event:ResultEvent):void { var inSr:SpatialReference = new SpatialReference(4326); var outSr:SpatialReference = new SpatialReference(3857); var gArr:Array = new Array(); var myGraphics:Array = new Array(); var x:XML = XML(event.result); pntList = x..entry; for (var i:int; i < pntList.length(); i++) { var latlong:Array = pntList.point.split(" "); //create graphic attributes var attributes:Object = new Object(); attributes.name = pntList.name; // attributes["name"] attributes.region = pntList.region; // attributes["region"] attributes.summary = pntList.summary; // attributes["summary"] // you can hold/add/remove/read/... on client side any attribute types you want attributes.myBool = false; // type Boolean attributes.creationDate = new Date(); // type date attributes.myComplexAttribute = new MyComplexAttribute(); attributes.symbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.CIRCLE, ...); var myPoint:Geometry = new MapPoint(latlong[1], latlong[0], inSr); var coordGraphic:Graphic = new Graphic(myPoint, null, attributes); gArr.push(myPoint); myGraphics.push(coordGraphic); } geometryService.project(gArr, outSR, new AsyncResponder(onProjectComplete, onProjectFault, myGraphics)); }
protected function pointsXML_resultHandler(event:ResultEvent):void { var inSr:SpatialReference = new SpatialReference(4326); var outSr:SpatialReference = new SpatialReference(3857); var gArr:Array = new Array(); var myGraphics:Array = new Array(); var x:XML = XML(event.result); pntList = x..entry; for (var i:int; i < pntList.length(); i++) { var latlong:Array = pntList.point.split(" "); //create graphic attributes var attributes:Object = new Object(); attributes.name = pntList.name; // attributes["name"] attributes.region = pntList.region; // attributes["region"] attributes.summary = pntList.summary; // attributes["summary"] // you can hold/add/remove/read/... on client side any attribute types you want attributes.myBool = false; // type Boolean attributes.creationDate = new Date(); // type date attributes.myComplexAttribute = new MyComplexAttribute(); attributes.symbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.CIRCLE, ...); var myPoint:Geometry = new MapPoint(latlong[1], latlong[0], inSr); var coordGraphic:Graphic = new Graphic(myPoint, null, attributes); gArr.push(myPoint); myGraphics.push(coordGraphic); } geometryService.project(gArr, outSR, new AsyncResponder(onProjectComplete, onProjectFault, myGraphics)); }
private function mClick(event:MouseEvent):void { var gra:Graphic = event.target as Graphic; var vbox:VBox = new VBox(); vbox.height = 40; vbox.width = 170; vbox.label = gra.attributes.name.toString(); var button:Button = new Button(); button.height = 40; button.width = 170; button.label = gra.attributes.region.toString(); button.addEventListener(MouseEvent.CLICK, click); vbox.addChild(button); map.infoWindow.content = vbox; map.infoWindow.closeButton.height = 15; map.infoWindow.closeButton.width = 15; map.infoWindow.show(gra.geometry as MapPoint); } private function click(event:MouseEvent):void { navigator.pushView(newView); }
How can I pass my attributes to another view?
If you want to pass some data from one view to another (for example an ArrayCollection or some other Data Model), then you can use the second argument of the navigator.pushView() method:
navigator.pushView(SecondScreen, myData);