1 Reply Latest reply on Aug 17, 2009 9:44 PM by Gregory Lafrance

    Flex - HttpService - how to display an arraylist in flex combobox

    ksunil123

      I have written an httpservice which returns an arraylist, in the tomcat logs I can see that an arraylist is being returned properly. However I am not able to display the arraylist

       

      Can any one please let me know what wrong i am doing ?

       

      Also the httpservice has been declared inside the pannel while I am using the dataprovider which is inside a tab navigator, this tab navigator is inside the pannel

       

      ------------------------------------------------------------------------------------------ -------------------------------------------------------------

      <?xml version="1.0" encoding="utf-8"?>

      <mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="800" height="1000">

       

       

      <mx:HTTPService id="gethttpRequest"

      result="gethttpResultHandler(event)"

      fault="gethttpFaultHandler(event)"

      showBusyCursor="true"

      method="post"

      >

       

      </mx:HTTPService>

      <mx:Script>

      <![CDATA[

      import mx.controls.Alert;

      import mx.collections.XMLListCollection;

      import mx.collections.ArrayCollection;

      import mx.rpc.events.FaultEvent;

      import mx.rpc.events.ResultEvent;

       

      // var priorityarray:Array = new Array;

       

      public function init():void {

      var rnd : Number = Math.round(Math.random()*1000);

      gethttpRequest.url = "http://localhost:8400/msgtracker/servlet/GetPriorities"+"/"+rnd;

      gethttpRequest.send();

       

      }

       

      [Bindable]

      var priorityC:Array = new Array;

      public function gethttpResultHandler(event:ResultEvent):void {

       

      var priority:ArrayCollection = event.result as ArrayCollection;

      priorityC[0] = priority.getItemAt(0);

       

       

      }

       

      public function gethttpFaultHandler(event:FaultEvent):void {

       

      }

       

      ]]>

      </mx:Script>

      <mx:TabNavigator left="81" right="79" top="41" bottom="196" creationComplete="init()">

       

      <mx:Canvas label="Log a Ticket" width="100%" height="100%">

       

       

      <mx:Label x="10" y="10" text="Subject"/>

      <mx:Label x="10" y="37" text="Description"/>

      <mx:TextInput x="99" y="8"/>

      <mx:Label x="10" y="133" text="Created Date"/>

      <mx:Label x="10" y="103" text="Created By"/>

      <mx:TextInput x="99" y="101"/>

      <mx:TextInput x="99" y="131"/>

      <mx:TextArea x="99" y="36" height="28"/>

      <mx:Label x="10" y="83" text="Type"/>

      <mx:ComboBox x="99" y="72"></mx:ComboBox>

      <mx:Label x="10" y="192" text="Status"/>

      <mx:ComboBox x="99" y="192"></mx:ComboBox>

      <mx:Label x="10" y="159" text="Priority"/>

      <mx:ComboBox x="99" y="159" dataProvider="{priorityC}"></mx:ComboBox>

      <mx:Label x="10" y="223" text="Solution"/>

      <mx:TextArea x="99" y="222"/>

      <mx:ControlBar x="32" y="291" width="264">

      <mx:Button label="Submit"/>

      <mx:Spacer width="100"/>

      <mx:Button label="Cancel"/>

      </mx:ControlBar>

      </mx:Canvas>

       

      <mx:Canvas label="List All Tickets" width="100%" height="100%">

      </mx:Canvas>

      </mx:TabNavigator>

      </mx:Panel>