Wud gr8ly appreciate if some1 can advise me about a better way to refer to newly created instances in the function ‘Move’ below:
interval = setInterval(CreateBullet, maxTime*Math.random());
function CreateBullet() {
clearInterval(interval);
bulletName = "car"+bulletCount;
newBullet_mc = _root.attachMovie("car", bulletName, bulletCount);
newBullet_mc._x = startX;
newBullet_mc._y = startY;
newBullet_mc.onEnterFrame = Move;
bulletCount++;
interval = setInterval(CreateBullet, maxTime*Math.random());
}
function Move() {
if (this._y >= 318){this._y -= 1;}
}
My problem arises since all newly created instances of ‘car’ are referred to as ‘this.’. So if I want, for example, instances whose y-position is >= 318 to move in a certain way, every other instance, whether or not >= 318, also starts moving!!: (
So…can I use “car”+bulletCount, for instance, in ‘Move’ in a ‘for’ loop to deal with only the instances I want to??
lk forward in anticipation!