I am trying to create a system that displays the name of the button that you press. The button names are put into an array, however it only recognized the last item entered into the array. Help would be greatly appreciated.
var items:Array = [a, b, c]; //The name of each button
for each(var index in items)
{
index.addEventListener(MouseEvent.CLICK, mouseClickHandler);
}
function mouseClickHandler(event:MouseEvent):void
{
trace(index.name); //Should display the name of any of the buttons clicked.
}