256 levels of recursion were exceeded...
Hey all,
I'm working on a little drawing tool. The drawing area is made up of 400 MCs. I have written a 'fill' function but it keeps getting the '256 levels of recursion were exceeded' error. Below is the code, what am I doing wrong?
It checks if the transform of the to be transformed MCs equals the transform of the first clicked MC. If so it tells that MC to preform the function. To no avail.
Please help me out on this one. I'm going crazy here...
Cheers,
Hendricus
Code:
function fill() {
beforetransform = _root.beforetransform;
currentpx = name;
// checking the row of the clicked pixel
for (i=name; i>0; i=i-_root.numBlocksX) {
currentrow++;
}
pixels = ["px"+(currentpx)];
if (currentpx-_root.numBlocksX>0 && eval("_root.px"+(currentpx-_root.numBlocksX)+".canvas._alpha") == beforetransform) {
pixels.push("px"+(currentpx-_root.numBlocksX));
}
if (currentpx+_root.numBlocksX<_root.totalBlocks && eval("_root.px"+(currentpx+_root.numBlocksX)+".canvas._alpha") == beforetransform) {
pixels.push("px"+(currentpx+_root.numBlocksX));
}
for (i=currentpx-1; i>0; i=i-_root.numBlocksX) {
rowleftpx++;
}
for (i=currentpx+1; i>0; i=i-_root.numBlocksX) {
rowrightpx++;
}
if (rowleftpx == currentrow && eval("_root.px"+(currentpx-1)+".canvas._alpha") == beforetransform) {
pixels.push("px"+(currentpx-1));
}
if (rowrightpx == currentrow && eval("_root.px"+(currentpx+1)+".canvas._alpha") == beforetransform) {
pixels.push("px"+(currentpx+1));
}
for (i=0; i<pixels.length; i++) {
eval("_root."+pixels[i]+".canvas")._alpha = _root.alpha;
eval("_root."+pixels[i]).fill();
}
}