I want to add a child at every grid point, I’m stumped how can I create a grid with the array by adding a child at every point? Pretty much replace the graphic circles with the hitArray children.
here is the code:
var bWidth:Number = stage.stageWidth;
var bHeight:Number = stage.stageHeight;
var grid:Number = 20; // Size of the grid and number of lattice points in each direction
var dotsWide:Number = Math.ceil(bWidth/grid) - 1;
var dotsHigh:Number = Math.ceil(bHeight/grid) - 1;
var board:Sprite = new Sprite();
stage.addChild(board);
//board.addChild(myPoint);
//Array to hold the target instances, the drop instances,
var hitArray:Array = new Array();
for (var k:int = 0; k < 1000; k++) {
hitArray[k] = new MovieClip();
hitArray[k].name = "target" + k;
addChild(hitArray[k]);
hitArray[k].x = ??;
hitArray[k].y = ??;
}
var dropArray:Array = new Array(drop1,drop2,drop3);
var positionsArray:Array = new Array();
// A bunch of circles to represent lattice points but instead want the child
board.graphics.beginFill(0x000000);
for (var l=1; l<=dotsHigh; l++) {
for (var j=1; j<=dotsWide; j++) {
board.graphics.drawCircle(j*grid,l*grid,3);
}
}
board.graphics.endFill();