Please help on passing data..

1017
2
Jump to solution
03-26-2012 02:29 AM
sherlytobias
New Contributor
Can someone please give me an idea on how can I pass my attributes to another view? Please please please.
In parsing my attributes,
  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 attributes:Object = new Object();      attributes.name = pntList.name; // attributes["name"]      attributes.region = pntList.region; // attributes["region"]      attributes.summary = pntList.summary; // attributes["summary"]


In accessing my attributes,
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);    }


This is my problem how can I pass my attributes to the view, Properties.. Please any idea? I tried some codes but didn't work... Please..
private function click(event:MouseEvent):void    {      navigator.pushView(Properties);    }
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
AndyGup
Esri Regular Contributor
@saibotehs, one way to do this if you have complex attributes is to set up a SharedObject. When the new view becomes active you can then grab the attributes from the SharedObject. The advantage of this pattern is it gives you a central location to manage all your application attributes. There's an example of this and other best practices built into this demo app: http://www.arcgis.com/home/item.html?id=f30c1e7747db417cae341fdeca2eb77e. All code is included.

-Andy

View solution in original post

0 Kudos
2 Replies
IvanBespalov
Occasional Contributor III
Understanding Flex Mobile View and ViewNavigator
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);
0 Kudos
AndyGup
Esri Regular Contributor
@saibotehs, one way to do this if you have complex attributes is to set up a SharedObject. When the new view becomes active you can then grab the attributes from the SharedObject. The advantage of this pattern is it gives you a central location to manage all your application attributes. There's an example of this and other best practices built into this demo app: http://www.arcgis.com/home/item.html?id=f30c1e7747db417cae341fdeca2eb77e. All code is included.

-Andy
0 Kudos