Hi Guys,
I am relatively new to AS and Flash, but I’m starting to get an understanding of its main concepts. However, I am struggling with one thing at the moment. All I want to do is to be able to create a grid in a movieclip container. The following script works perfectly if you want to add a grid to the stage:
function tileGrid(){
grid_width = 10;
grid_height = 10;
//
x_max = Math.round(Stage.width/grid_width);
y_max = Math.round(Stage.height/grid_height);
for (x=0; x<x_max; x++)
{
for (y=0; y<y_max; y++)
{
bg = _root.attachMovie("grid", "gd"+x+y,
this.getNextHighestDepth());
bg._x = grid_width*x;
bg._y = grid_height*y;
}// End of inner loop
}// End of outer loop
}
However I only want to create a grid in a movieclip container called “contentArea_mc”, but so far, instead of tiling the grid, it only attaches one cell:
function tileGrid(){
grid_width = 10;
grid_height = 10;
//
x_max = Math.round(this.contentArea_mc._width/grid_width);
y_max = Math.round(this.contentArea_mc._height/grid_height);
for (x=0; x<x_max; x++)
{
for (y=0; y<y_max; y++)
{
bg = this.contentArea_mc.attachMovie("grid", "gd"+x+y,
this.getNextHighestDepth());
bg._x = grid_width*x;
bg._y = grid_height*y;
}// End of inner loop
}// End of outer loop
}
button_mc.onRelease = function () {
if (button_mc._currentframe == 1) {
button_mc.gotoAndStop("on");
tileGrid();
}else {
button_mc.gotoAndStop("off");
}
}
Furthermore, clicking on the movie clip button keeps movie the cell diagonally downward to the bottom right. I don’t really know what that is.
Can anybody please help?
Please find attached a copy of the source file.
Many Thanks TAJ