;

PDA

Click to See Complete Forum and Search --> : one listener, many buttons. Is it possible?


martin47
08-24-2006, 05:03 PM
I have many buttons on screen. About 25. They are all different shapes. Is there a way to have a listener that can inform me the _name of the button clicked when any of them is clicked? Thanks ahead for any help.

VI Knight
08-24-2006, 06:34 PM
you can do this in actionscript with variable passing. each button thas tis clicked passes itself into a function that gets the button name(providing you give it an instance name) and does whatever you want to do with it.


myButton_btn.onRelease = function(){
getName(this);
}


function getName(button){
trace(eval(button)._name);
}

martin47
08-25-2006, 11:03 AM
Thanks Knight, IŽll try that, sounds like a great solution!