I have this code:
for each(var tool in tools){
tool.addEventListener(MouseEvent.MOUSE_DOWN, function(){
trace(tool); //Always the last tool
});
}
You can't nest functions inside loops the parameters for the function call will have the same value across all iterations of the loop, and that value will be from the last most iteration. There are some hacks to handle this, but it is not good coding practice and makes it hard in the future to modify it.
What you need to do is more OOP style.
Since the Tool class is obviously custom you need to modify it to hold the values or whatever references you were talking about for the future.
Basically, if you have a value you need to pass along that is related to that object then just make that value an attribute of the class Tool.