1 Reply Latest reply on Apr 6, 2011 10:17 PM by Tanu Jain

    Getting index of selected repeater child in mouseOver event

    Ameya Mogare

      Hi,

       

      I have a VBox which has a repeater that repeates 'text' UI components.

       

      On MouseOver of any Text, I want to get the index of that particular text UI element in VBox. That is, I want to know where it appears, 0th, 1st, 2nd and so on.

       

      Please let me know how to do it?

       

      Thanks and regards,

      Amey

        • 1. Re: Getting index of selected repeater child in mouseOver event
          Tanu Jain Level 2

          Try assigning repeater's current Index with some property of UIText (or make a custom label/UIText to add custom property)

          Handle mouseOver event of UIText.

          Access the specific property of the target UIText.

           

          For example:

          <mx:Repeater id="rep" dataProvider="{myArray}">

               <mx:Label text="{rep.currentIndex}"  mouseOver="label1_mouseOverHandler(event)"/>

          </mx:Repeater>

           

          <fx:Script>

          <![CDATA[

              

               protected function label1_mouseOverHandler(event:MouseEvent):void

               {

                    trace((event.currentTarget as Label).text);

               }

           

              

               [Bindable]

               public var myArray:Array=[1,2,3,4];

               ]]>

          </fx:Script>

           

          --

          Tanu