code_junkie

flex 3 webservice results issue

Nov 14th, 2011
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. public function resultHandler(event:ResultEvent):void{
  2. var result:ArrayCollection = event.result as ArrayCollection;
  3.  
  4. public function resultHandler(event:ResultEvent):void
  5. {
  6. var ac:ArrayCollection = new ArrayCollection([event.result])
  7. // ...
  8. }
  9.  
  10. var o:Object = ac.getItemAt(0) as Object;
  11. trace(o.yourObjectProperty.toString());
  12.  
  13. if (event.result is ArrayCollection) {
  14. result = event.result;
  15. }
  16. else {
  17. result = new ArrayCollection([event.result]);
  18. }
  19.  
  20. private var _acLocation:ArrayCollection=new ArrayCollection;
  21.  
  22. public function set acLocation(acLocation:ArrayCollection):void{
  23.  
  24. _acLocation=acLocation;
  25.  
  26. //do this if you want for exaple to assign the arraycollection to a datagrid dataprovider
  27.  
  28. dgMyDataGrid.dataProvider=_acLocation;
  29.  
  30. }
  31.  
  32. public function get acLocation():ArrayCollection{
  33.  
  34.  
  35. return _acLocation;
  36. }
  37.  
  38. acLocation=new ArrayCollection(event.result as Array);
Add Comment
Please, Sign In to add comment