[AS 2.0] refering to multiple objects! HELP!

[FONT=Arial]
edit:

this problem has been solved. thank you.
i only had to remove the “else{ return false;}” bit.

hey all! fist post…!

I’m an animator who kinda wants to be able to do some actionscript but who isn’t that good at it.
atm I’m trying to make something which contains a hitTest() which should check if my movieclip (doll_mc) is touching any instance of “ground”.

My attempt to make a code for this has dramatically failed and this is all I managed to make which does make a bit of sense:
[/FONT]
[FONT=Courier New]
var nrOfgrounds:Number = 2; /this is the number of instances, which should be kept up-to date with the project, of course./

setInterval( groundCheck(doll_mc), 25);

function groundCheck(obj:MovieClip):Boolean{ /*returns boolean groundCheck(<objectName> [in this case, “doll_mc”]); */

**[COLOR=Black]for (var i:Number = 1; i &lt;= nrOfGrounds; i++) {[/COLOR]** /* &lt;- i've got a feeling like this bit ain't working properly*/

    if (obj.hitTest(_root["ground" + i + "_mc"])){
        return true;
    }
    else{ return false;}
}

}[/FONT]

[FONT=Arial]Every instance of “ground” has an own name, like: “ground1_mc” or “ground2_mc”.[/FONT]

Now I don’t understand why it isn’t working like it should, but I suspect that the program is not making “i” bigger, for some reason.

groundCheck(doll_mc) isn’t true when doll_mc is touching ground2_mc, but groundCheck(doll_mc) is true only when doll_mc is touching ground1_mc. HOW COME???

I tried replacing the bold bit with

[FONT=Courier New][COLOR=Black]for (var i:Number = [SIZE=5]2[/SIZE]; i <= nrOfGrounds; i++) {[/COLOR][/FONT]

just to see what would happen, and yes, this time groundCheck(doll_mc) would only be true when doll_mc was touching ground2_mc, but not when touching ground1_mc. therefore there must be something wrong with that one bit of code, but I can’t figure out what!

cud you guys please help me out?
thanks :wink:

zapp