Using metadata to create listeners

Hi, (I think this is in the wrong forum… sorry! Should be AS3)

I am trying to dynamically create listeners using metadata from a list of instance names in an array. Here is my code:
[INDENT][SIZE=1]var menuItems:Array = new Array(“button1”,“button2”)[/SIZE]

[SIZE=1]for (var ele:String in menuItems)[/SIZE]
[SIZE=1] {[/SIZE]
[SIZE=1] [menuItems[ele]]addEventListener(MouseEvent.CLICK, PopUp); [/SIZE]
[SIZE=1]}[/SIZE]

[SIZE=1]function PopUp(evt:MouseEvent):void[/SIZE]
[SIZE=1]{[/SIZE]
[SIZE=1] trace(evt.currentTarget.name);[/SIZE]
[SIZE=1]}[/SIZE]
[/INDENT]
When the buttons are clicked, the trace shows “root1”.

Is there a way to make it pickup the actual name (button1 or button2)?

Thank you!