0 Replies Latest reply on Apr 26, 2007 9:43 PM by spacecycle

    Retrieving Selected CheckBox Value from a Repeater

      I created dynamic CheckBox with Data from xml file (e4x format) through HttpService using the the Repeater Component. I having problems retrieving the Checkbox label value after the user checks the checkbox or checkboxes.

      Here is the code below:
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="carData.send(event)">

      <mx:HTTPService id="carData" url="assets/carData2.xml" result="carDataHandlerChkBox(event)" resultFormat="e4x"/>

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


      private var optionsArray:Array = new Array();

      [Bindable]
      private var optionsColl:ArrayCollection;



      public function carDataHandlerChkBox(event:ResultEvent):void {

      //looping function to convert xml for option node to ArrayCollection

      for each (var c:XML in event.result.car.options.option){

      optionsArray.push(c);
      }
      optionsColl = new ArrayCollection(optionsArray);

      }

      <mx:CheckBox label="{rp.currentItem.amount}" id="chkBox" click="updateChkBox(event.currentTarget.getRepeaterItem())"/>
      </mx:Repeater>

      </mx:Tile>

      </mx:Application>


      I am stuck at the part where I need to write the function for "updateChkBox". Once the user selects the checkbox, I want to retrieve the ".amount" in the xml which is in the label of the CheckBox as {rp.currentItem.amount}. If the user selects multiple checkboxes, I would like to total the the selected checkbox "amounts".

      Any help will be greatly appreciated. Thank you