2 Replies Latest reply on Apr 9, 2009 6:16 AM by vpxav

    How to get a component's value inside a repeater using the component's id?

    vpxav Level 1

      Hello I'm using a repeater with an httpservice as dataprovider.

       

       

      in this repeater, I have a <mx:Panel> containing a <mx:Text>, a <mx:ButtonBar>, and a <mx:HSlider>.

       

      I need to get the text property of the Text component and the HSlider's value when the slider's value changed. (using the "change=..." property of my HSlider).

       

       

      How to do this as I have to know which Panel, HSlider, and which Text has been activated by the slider change?

      Thanks for your help

        • 1. Re: How to get a component's value inside a repeater using the component's id?
          Michael Borbor Level 4

          This might help you.

           

          <?xml version="1.0"?> 
          <!-- repeater\GetItem.mxml -->
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
          
            <mx:Script> 
              <![CDATA[
                   import mx.controls.Alert;
                 
                 [Bindable]
                 public var myAC:Array=[1,2,3,4];
                       
                 public function getData(event:Event):void{
                           Alert.show(event.currentTarget.text);
                           Alert.show(mySlider[event.target.repeaterIndices].value);
                 }
              ]]>
            </mx:Script> 
           
          
            <mx:Repeater id="myrep" dataProvider="{myAC}"> 
                <mx:TextInput change="getData(event);" />
                <mx:HSlider id="mySlider" maximum="200" minimum="50" value="67"  snapInterval="1"/>
            </mx:Repeater> 
          </mx:Application>
          
          
          • 2. Re: How to get a component's value inside a repeater using the component's id?
            vpxav Level 1

            Michael Borbor a écrit:

             

             

            ... [event.target.repeaterIndices] ...     

             

            Yes! Michael, thank you soooo much!

             

            I'm a total newbie in Flex and I've been looking for a solution for days... I couldn't find any documentation or tutorial about this...

             

            Thanks a lot!

             

            +10