2 Replies Latest reply on Oct 7, 2008 7:36 AM by John Hall

    Anonymous function in eventListener

    John Hall Level 4
      I have a radioButton group and I'd like to reset the buttons so that they are not selected each time I enter the state. Right now I'm using the following code on the button:

      creationComplete="this.addEventListener('reset',function():void {q1_yes.selected=false})"

      and when I enter the state, I do a simple dispatch:

      dispatchEvent(new Event('reset'));

      This works, but this means for each radioButton, I have to have the unique name of the button in the listener. I've tried 'this' and 'target' etc. and find nothing that can make this more general and elegant. Any suggestions on a better approach to resetting radioButtons?