[Javascript] assigning a new value to an array element
dave tee
teedave at hotmail.com
Wed Oct 31 03:58:49 CST 2001
i'm looping thru an array and trying to randomly access the elements of
another array and match them up. once used , Im trying to reassign the value
of the element so I can test and only use it once.
Something like below. What im hoping to achieve is that a new value for pos
is produced that has not been used before. what i get is an error or a
neverending loop!
Any help greatfully accepted!
for (i=0; i<=36; i++) {
var pos = Math.floor(Math.random()*36);
while(xposarray[pos]==null){
pos = Math.floor(Math.random()*36);
}
setProperty (cliparray[i], _x, xposarray[pos]);
setProperty (cliparray[i], _y, yposarray[pos]);
xposarray[pos] = null;
}
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
More information about the Javascript
mailing list