4 Replies Latest reply on Nov 10, 2010 6:20 AM by mattcom

    Altering button click event programmatically

    mattcom Level 1

      Hi all.  I would like to pass in the click event action through my result.

       

      For example, I have an array that creates buttons through a repeater.

       

      Array = [{ label: 'Flex", action: "navigateToURL(new URLRequest('http://www.adobe.com/flex', '_blank'));"},

      { label: "Flash", action: "Alert.show('I like Flash too!');" }

       

      And then my repeater makes buttons like this

       

      <mx:Button label="{repeater.currentItem.label}"

           click="Alert.show(event.currentTarget.getRepeaterItem().action);"/>

       

      Now the above button works, but what I would like the button to do is the action itself, like this example below:

       

      <mx:Button label="{repeater.currentItem.label}"

          click="event.currentTarget.getRepeaterItem().action;"/>

       

      However, it does nothing.

       

      Any suggestions?  I have to be close...

       

      Thanks in advance!