How to add event listeners to an array of objects
问题 I have an array of objects (specifically easelJS images) - something like this: var imageArray = new Array; gShape = new createjs.Shape(); // shape is something imageArray.push(gShape); What I want to do is have an event listener instead of: gShape.addEventListener("click", function() {alert"stuff"}); I want the program to know specifically which region is clicked so that I can send an alert box in the following way: imageArray[index].addEventListener("click", function(){ alert " you clicked