How to pass a property to an event with a Button

Posted by Tam on Stack Overflow See other posts from Stack Overflow or by Tam
Published on 2010-03-20T04:45:59Z Indexed on 2010/03/20 4:51 UTC
Read the original article Hit count: 150

Filed under:
|

I'm generating buttons dynamically that I want it to call a method like this:

private function fetchTheDay(day:String):void {
...             
}

But I wasn't sure how to make the button pass the string to it

button.addEventListener(MouseEvent.CLICK,fetchTheDay);
buttonVGroup.addElement(button);

trying to do something like this didn't work:

 button.addEventListener(MouseEvent.CLICK,fetchTheDay(myString));

How should I do this?

© Stack Overflow or respective owner

Related posts about flex

Related posts about actionscript-3