0 Replies Latest reply on Dec 18, 2007 8:05 AM by nrutter

    Filter Data based on ArrayCollection

    nrutter Level 1
      I have a text box that I want to enter a number into. Based on the number typed I would like to populate a label with a result from my array collection. I want this to do this on change no submit. I am getting my result back and my array looks like this.
      incentive=100 maximun = 4999.99 minimum = 25000
      incentive=200 maximun = 74999.99 minimum = 50000

      So basically what I want to happen is when the amount of 35000.00 is entered into my textInput it will place 100.00 in my label. Any thoughts on how to do this?


      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" backgroundGradientColors="[#ffffff, #ffffff]" width="680" height="342">

      <mx:RemoteObject
      id="cfService"
      destination="ColdFusion"
      source="com.calculate"
      result="dataHandler(event)"/>


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

      [Bindable]
      private var calcData:ArrayCollection;

      private function oldHomeChange(): void{
      trace(old_home.text);
      }

      private function dataHandler(event:ResultEvent):void
      {
      calcData = new ArrayCollection(event.result as Array);
      }
      ]]>
      </mx:Script>


      <mx:Text x="132" y="89" text="Old Home Sale Price:" width="109" height="57" id="home1" fontSize="18" color="#a30046" fontFamily="Arial" textAlign="center"/>
      <mx:Text x="285" y="89" text="New Home Purchase Price:" width="136" height="57" id="home2" fontSize="18" color="#a30046" fontFamily="Arial" textAlign="center"/>
      <mx:Label x="94" y="229" width="118" id="cashOld" text="600.00" color="#a30046" fontSize="15" fontWeight="bold" height="44" fontFamily="Arial" textAlign="center"/>
      <mx:TextInput x="139" y="137" width="101" id="old_home" change="oldHomeChange()"/>
      <mx:TextInput x="303" y="137" width="101" id="new_home"/>
      <mx:Text x="94" y="192" text="Cash Back Incentive:" width="109" height="64" id="CashOP" fontSize="15" color="#a30046" fontFamily="Arial" textAlign="center" fontWeight="bold"/>
      <mx:Text x="203" y="249" text="Total Incentive:" width="109" height="78" id="CashOP0" fontSize="20" color="#004a8d" fontFamily="Arial" textAlign="center"/>
      <mx:Text x="312" y="192" text="Cash Back Incentive:" width="109" height="57" id="CashBP" fontSize="15" color="#a30046" fontFamily="Arial" textAlign="center" fontWeight="bold"/>
      <mx:Label x="320" y="231" width="84" id="cashNew" text="600.00" color="#a30046" fontSize="15" fontWeight="bold" height="44" fontFamily="Arial" textAlign="center"/>
      <mx:Label x="220" y="302"
      text="{Number(cashNew.text) + Number(cashOld.text)}"
      id="total" color="#004a8d" fontSize="20"/>

      <mx:Button label="Call Coldfusion" x="85" y="72" click="cfService.getDataAsArray()"/>
      <mx:DataGrid dataProvider="{calcData}"/>



      </mx:Application>