1 Reply Latest reply on Aug 4, 2008 1:13 PM by Gregory Lafrance

    Button Event

    nash99
      Hi ,
      I am using a Item Renderer in a data grid .
      I have a button component in the Item renderer , when I click the button I am sending event as a parameter in the click of the button --(ie in the function getDetail(event,col1) )
      I need to send a button event instead of mouse event , how do I do that
      code--
      <mx:itemRenderer>
      <mx:Component>
      <mx:HBox horizontalAlign="center">
      <mx:Button id="col1" label="Y" width="75" click="outerDocument.getDetail(event,col1)" />
      </mx:HBox>
      </mx:Component>
      </mx:itemRenderer>

      Code from the ACtion Script File---

      public function getDetail(event:MouseEvent,button1:Button):void{


      currentState1 = button1.label;

      if(( currentState1 == null)||( currentState1 == 'Y'))
      // if ( currentState1 == 'X')
      {
      currentState1 = "Y";

      }
      var States : Array = new Array("Y", "N", "*", "-");
      var i :int;
      for( i=0;i<States.length;i++)
      {
      if ( currentState1 == States )
      {
      button1.label = States[i+1];

      }
      if ( currentState1 == States[3])
      {
      button1.label = States[0];
      }
      }
      }



      I am trying to change the button label dynamically (I also have to capture the label)
      on button click event.
      The problem is -- I am able to change the label successfully but After I click the button I had to move the cursor(ie on mouse event) to see the label change.

      Can anyone assist me how do I change the label just on "Button click event " rather than on "Mouse event"
      (I need to seperate the action script files and mxml files)