2 Replies Latest reply on Apr 27, 2007 10:28 PM by thedex1

    Get the button ID

    thedex1
      Consider the code below:

      <mx:Repeater id="colRep" dataProvider="{colOneColection}">
      <mx:LinkButton id="btn" label="{colRep.currentItem.label}" click="showText(event,'0')"/>
      </mx:Repeater>

      When we click any of the LinkButton, the id of LinkButton will be passed as an array to showText function. Now my question is that how I come to know that which LinkButton is clicked from the array it passed to showtext function.

      Also I want to know how to get the number of nodes in an XML file. For example:

      <root>
      <sample>
      <name>
      <text>
      </sample>
      <sample>
      <name>
      <text>
      </sample>
      <sample>
      <name>
      <text>
      </sample>
      </root>

      How I can get the number of sample nodes in the above example.

      Any help and suggestion will be greatly appreciated.

      thanks,

      Regads,
      Wahab
        • 1. Re: Get the button ID
          dimival Level 1
          Use the currentTarget property of the event to obtain the id, like this:

          public function showText(event:Event):void
          {
          Alert.show(event.currentTarget.id.toString());

          }
          • 2. Re: Get the button ID
            thedex1 Level 1
            Dear Dimival,

            I really thank you for replying me with what I badly need. I realy thank you very much. My MSN account ID is "de.xsense@hotmail.com". I would greatly appreciate if either you add me to your contact list or let me know your email address. I am not asking your hotmail ID to ask you a lot of questions, just would like to be a friend to share new ideas and knowledge.

            Thanks again

            Regards
            ..::DW