1 Reply Latest reply on Oct 17, 2006 1:59 PM by Java_Hero

    Submit ArrayCollect Item to HTTPSERVICE

    thezo
      I have an an array collection that is built from a httpservice and populates a datagrid. I would like to choose an item from the array and submit it to another httpservice.

      Example:
      A user does a search for a taxlot and returns three resuts into the array:
      id taxLot Address
      1 XXX 123 Main
      2 XXX 122 Main
      3 XXX 124 Main

      A data grid (or another control like a menu - Doesn't matter to me) displays only the address. The user clicks 124 Main and 3 is submitted to the 2nd HTTPService.

      Here's my relevant code so far:

      <mx:HTTPService id="MapTaxlots" url=" http://Atlas:3000/addresses/list3" useProxy="false" result="AdderList= ArrayCollection(MapTaxlots.lastResult.addresses.address)"/>
      <mx:HTTPService id="AddressRequest" url=" http://Atlas:3000/addresses/list3" useProxy="false" method="GET"/>

      <mx:Script>
      <![CDATA[
      import mx.collections.ArrayCollection;
      import mx.rpc.events.ResultEvent;

      [Bindable]

      private var AdderList:ArrayCollection;
      private function resultHandler(event:ResultEvent):void
      {
      AdderList = new ArrayCollection(MapTaxlots.lastResult.addresses.address);
      }
      ]]>

      <mx:DataGrid id="AdderGrid" dataProvider="{AdderList}" >
      <mx:columns>
      <mx:DataGridColumn headerText="" dataField="ADDRESS"/>
      </mx:columns>
      </mx:DataGrid>
      </mx:Application>

      Thanks for any help you can give.






        • 1. Re: Submit ArrayCollect Item to HTTPSERVICE
          Java_Hero
          Hey thezo,
          i believe to access an element in the array you would write the following:
          [Bindable]
          private var xmlString:String;
          xmlString=AdderList.getCharAt(index).element;

          So if i wanted to get the applepie text in the following xml, this is how i would do it.

          <food>
          <menu>
          <element1>applepie</element1>
          <element2>cheesecake</element2>
          </menu>
          <menu>
          <element1>chips</element1>
          <element2>dips</element2>
          </menu>
          </food>

          below is my binding and element access:
          <mx:Script>
          <![CDATA[
          import mx.collections.ArrayCollection;
          import mx.rpc.events.ResultEvent;

          [Bindable]
          private var foodArrayCollection;
          [Bindable]
          private var xmlString:String;
          private function resultHandler(event:ResultEvent):void
          {
          foodArray= event.result.food.menu;
          xmString=foodArray.getCharAt(0).element1; -- this is where i would access my applepie
          }
          ]]>