For the above hot link I think this should help you out.
function flood_fill(x, y)
{
pos = x + y * 9;
if (fill_map[y][x] == 0)
{
fill_map[y][x] = 2;
_root["tile_" + (x + y * 9)].gotoAndStop(3);//this tells tile to stop its frame movrment at 3 if changed to 2 you would see black
flood_fill(x + 1, y);
flood_fill(x - 1, y);
flood_fill(x, y + 1);
flood_fill(x, y - 1);
}
}
onFrame (1) {
fill_map = new Array();//this is the version of computor programimg that makes up the areas you see
fill_map[0] = [1, 1, 1, 1, 1, 1, 1, 1, 1];
fill_map[1] = [1, 0, 0, 0, 1, 0, 0, 0, 1];
fill_map[2] = [1, 0, 0, 0, 1, 0, 0, 0, 1];
fill_map[3] = [1, 0, 0, 1, 0, 0, 0, 0, 1];
fill_map[4] = [1, 1, 1, 0, 0, 0, 1, 1, 1];
fill_map[5] = [1, 0, 0, 0, 0, 1, 0, 0, 1];
fill_map[6] = [1, 0, 0, 0, 1, 0, 0, 0, 1];
fill_map[7] = [1, 0, 0, 0, 1, 0, 0, 0, 1];
fill_map[8] = [1, 1, 1, 1, 1, 1, 1, 1, 1];
for (y = 0; y < 9; y++)
{
for (x = 0; x < 9; x++)
{
tile = _root.attachMovie("tile", "tile_" + (y + x * 9), _root.getNextHighestDepth(), {_x: y * 50, _y: x * 50});
tile.gotoAndStop(1 + fill_map[x][y]);
}
}
_root.attachMovie("cursor", "cursor", _root.getNextHighestDepth());
cursor.onEnterFrame = function ()
{
this._x = 50 * Math.floor(_root._xmouse / 50);
this._y = 50 * Math.floor(_root._ymouse / 50);
};
_root.onMouseDown = function ()
{
pos_x = Math.floor(_root._xmouse / 50);
pos_y = Math.floor(_root._ymouse / 50);
flood_fill(pos_x, pos_y);
};
}
The next part of the example:
function flood_fill(x, y)
{
pos = x + y * 9;
if (fill_map[y][x] == 0)
{
fill_map[y][x] = 2;
_root["tile_" + (x + y * 9)].gotoAndStop(3);
flood_fill(x + 1, y);
flood_fill(x + 1, y + 1);
flood_fill(x + 1, y - 1);
flood_fill(x - 1, y);
flood_fill(x - 1, y + 1);
flood_fill(x - 1, y - 1);
flood_fill(x, y + 1);
flood_fill(x, y - 1);
}
}
onFrame (1) {
fill_map = new Array();
fill_map[0] = [1, 1, 1, 1, 1, 1, 1, 1, 1];
fill_map[1] = [1, 0, 0, 0, 1, 0, 0, 0, 1];
fill_map[2] = [1, 0, 0, 0, 1, 0, 0, 0, 1];
fill_map[3] = [1, 0, 0, 1, 0, 0, 0, 0, 1];
fill_map[4] = [1, 1, 1, 0, 0, 0, 1, 1, 1];
fill_map[5] = [1, 0, 0, 0, 0, 1, 0, 0, 1];
fill_map[6] = [1, 0, 0, 0, 1, 0, 0, 0, 1];
fill_map[7] = [1, 0, 0, 0, 1, 0, 0, 0, 1];
fill_map[8] = [1, 1, 1, 1, 1, 1, 1, 1, 1];
for (y = 0; y < 9; y++)
{
for (x = 0; x < 9; x++)
{
tile = _root.attachMovie("tile", "tile_" + (y + x * 9), _root.getNextHighestDepth(), {_x: y * 50, _y: x * 50});
tile.gotoAndStop(1 + fill_map[x][y]);
}
}
_root.attachMovie("cursor", "cursor", _root.getNextHighestDepth());
cursor.onEnterFrame = function ()
{
this._x = 50 * Math.floor(_root._xmouse / 50);
this._y = 50 * Math.floor(_root._ymouse / 50);
};
_root.onMouseDown = function ()
{
pos_x = Math.floor(_root._xmouse / 50);
pos_y = Math.floor(_root._ymouse / 50);
flood_fill(pos_x, pos_y);
};
}
The main thing to remember is that in 3 you send your movie clips to the libary and link to them to attach to stage. Both examples below.
After this I'll look at you jpgs.
Wayne