I have this code:
for each(var tool in tools){
tool.addEventListener(MouseEvent.MOUSE_DOWN, function(){
trace(tool); //Always the last tool
});
}
Try this.
for each(var tool in tools){
tool.addEventListener(MouseEvent.MOUSE_DOWN, toolFunction )
}
function toolFunction (e:MouseEvent){
trace(e.currentTarget)
}
Aftear reading question title again, i realized, that what u need is custom event or:
for each(var tool in tools){
tool.addEventListener(MouseEvent.CLICK,
function(e:MouseEvent){toolFunction (e, "another param")},
false, 0, true);
}
function toolFunction (e:MouseEvent,anotherParam:String){
trace(e.currentTarget)
trace(anotherParam) //output "another param"
}