Shouldn't this work? Array related question

So i’m trying to figure out how to drop a dragged object onto any box, but no where else. So i tried using this:

[AS]
targArray = new Array();
targArray = [theTarget1, theTarget2, theTarget3, theTarget4, theTarget5, theTarget6, theTarget7, theTarget8, theTarget9];
[/AS]

theTarget1 and stuff are all instance names of the box. Then later on, i use:

if (eval(this._droptarget) == targArray) {

So doesn’t that mean if i drop the target anywhere on the instances then do whatever is next??

The bad thing is, it doesn’t seem to be working :-\ Anyone know whY? thanks! I’m helping someone out for this problem, but i got stuck myself :stuck_out_tongue:

http://www.kirupaforum.com/forums/showthread.php?threadid=31327

[AS]
for (i=0; i<=targArray.length; i++) {
if (eval(this._droptarget) == targArray) {
//dowhatever
}
}
[/AS]

Do you mean something like that? because it seems like i should be replacing targArray in the second line with something else… :-\

EDIT: btw, what does the break do?? thanks!

break goes out of the loop. it stops the loop from running.

o ok thanks, but how should i change the code? because it seems wrong and not working :-\

[AS]if (eval(this._droptarget) == targArray*) {[/AS]

oo yea its workin now, thanks :slight_smile:

No problem. :wink: