PDA

View Full Version : calling a variable with array??


florry
04-25-2002, 02:31 PM
I'm trying to get some variables to an array object like this

//--

var1 = Math.round((getProperty("/3", _x))+(getProperty("/3", _width)*-0.8));
var2 = Math.round((getProperty("/5", _x))+(getProperty("/5", _width)*-0.5));
var3 = Math.round((getProperty("/8", _x))+(getProperty("/8", _width)*-0.4));
var4 = Math.round((getProperty("/9", _x))+(getProperty("/9", _width)*-0.9));
// --
for (b=1; b<=3; b++) {
duplicateMovieClip ("bol", "bol" add b, 100+b);
setProperty ("bol" add b, _x, 'var' add Number(b));
setProperty ("bol1", _y, 245);
setProperty ("bol2", _y, 235);
setProperty ("bol3", _y, 225);
}


//--

But the setProperty ("bol" add b, _x, 'var' add Number(b)); part doesn't work. I'm trying to put the values of the variables created at the beginning of the script as an x postition for mc "bol" add b.

Does anyone gotta clue?!...;)

pinkaboo
04-25-2002, 03:20 PM
probably just a stab in the dark, but what the heck:


varArray = new Array ();
varArray[1] = Math.round((getProperty("/3", _x))+(getProperty("/3", _width)*-0.8));
varArray[2] = Math.round((getProperty("/5", _x))+(getProperty("/5", _width)*-0.5));
varArray[3] = Math.round((getProperty("/8", _x))+(getProperty("/8", _width)*-0.4));
varArray[4] = Math.round((getProperty("/9", _x))+(getProperty("/9", _width)*-0.9));
// --
for (b=1; b<=3; b++) {
duplicateMovieClip ("bol", "bol" add b, 100+b);
setProperty ("bol" add b, _x, varArray[b]);
setProperty ("bol1", _y, 245);
setProperty ("bol2", _y, 235);
setProperty ("bol3", _y, 225);
}

florry
04-25-2002, 04:00 PM
Hey man why didn't I think of that!

It works great thanks!!

pinkaboo
04-25-2002, 04:06 PM
Hooray!!
Glad to help :)
Kay