-
I have a scene, two frames. There are two movie clips, blocks, with the instance names "block1" and "block2".
The first frame has the actionscript:
block1._alpha = block1._alpha - 5;
block2._alpha = block2._alpha - 10;
To keep things moving second frame has the actionscript:
gotoAndPlay(1);
This is what I am trying to achieve, block1 fades slower than block2, great.
Enter the array.....
I change the actionscript in frame one to:
amount = array("5","10");
block1._alpha = block1._alpha - amount[0];
block2._alpha = block2._alpha - amount[1];
This also works fine and dandy, the problem comes when I try and put the instance names (block1 and block2) into an array:
block = array("block1","block2");
block[0]._alpha = block[0]._alpha - 5;
block[1]._alpha = block[1]._alpha - 10;
No fade.
Would it be that I am trying to do the impossible? Any comments or workarounds greatly appreciated
-
use the absolute path for ex. _root.block1
gparis
-
Code:
block = [block1, block2];
block[0]._alpha = block[0]._alpha - 5;
block[1]._alpha = block[1]._alpha - 10;
/*
or
block = ["block1", "block2"];
this[block[0]]._alpha = this[block[0]]._alpha - 5;
this[block[1]]._alpha = this[block[1]]._alpha - 10;
*/
-
Edit: sorry, was trying two things at the same time........
Thanks gSOLO_01, you hit the nail on the head with that second piece of code, I'm up and running.
Many thanks, you guys are unbelievably quick.
Old post................
Thanks for the quick replies, but so far no dice.
_root.block1._alpha = _root.block1._alpha - 5;
............works
blockarray = array("_root.block1","_root.block2");
blockarray[0]._alpha = blockarray[0]._alpha - 5;
............don't
[Edited by skalie on 09-24-2002 at 11:25 AM]