Why can’t I loop through a class object creation? I’m trying to create multiple instances of a point on a map, but it won’t let me “build” my name. When I do it without the unique names, all is well until I try to set up listeners, which all seem to point only to the last one created. I have a feeling I’m trying to fit 3.0 into my 2.0 mindset. Any help? Thx.
function addLocations() {
//In my library, I have a MC class “Location”, which has the basic art for each “location” being put on a map.
for (var i:Number =0; i<21; i++) {
var which = “Loc”+i;
which=new Location();
addChild(which);
which.addEventListener(MouseEvent.MOUSE_UP, openStats);
}
}
function openStats(event:MouseEvent) {
//here, I’d like to add a Mc or class to the stage, and customize it for the location pressed
//such as add a title, pull some text, etc. specific to the location
}
(Sorry about the bad formatting. Firefox is bugging on me)