Hello
I have a class with 3 object from a library
public class Car extends BaseCars {
In the class I made a for-loop because i want for each car a dot on my screen.
private var point:Sprite
....
for (var i:uint=0; i < this.numChildren; i++){
var dsp:DisplayObject = this.getChildAt(i);
point = new Sprite;
point.graphics.beginFill(0x0FAB905,1);
point.graphics.drawCircle(dsp.x/5, dsp.y/5, 30);
point.graphics.endFill();
addChild(point);
//trace(i);
}
Yet, the library contains 3 cars.
If I trace (i) is says in my output:
0
1
2
Same with the trace of ‘dsp’, also 3 x [object MovieClip]
But if I do ‘addChild(point);’
My browser crashes cause I’m in an infinite loop.
Thanks