Groups | Blog | Home
all groups > flash actionscript > may 2004 >

flash actionscript : button instance into array


DarkRide
5/24/2004 8:11:57 PM
I am trying to push a button instance into an array with a string, and then I
want to be able to display the button with the string. Can this be done? On
the display page, all the data is dynamic and random, so I can't just hide the
buttons and then show them when I need them, since their position changes,
based on the user's answer.

Any help would be greatly appreciated.
Teji
5/27/2004 3:15:13 AM
hi,
i think this might help

myBtn = new Array(_root.btn1 , _root.btn2, _root.btn3, _root.btn4);
for (var i in myBtn)
{
myBtn._alpha = 50;
}

btn1, btn2, btn3,btn4 are buttons on the stage
bye

kglad
5/27/2004 5:13:52 AM
if you're pushing your instances using strings then you'll need to use bracket
notation to direct flash to resolve those strings into objects. for example,
if you have:

yourA=new Array("btn0","btn1");

then you can reference btn0 on the _root timeline by using:

_root[yourA[0]]
AddThis Social Bookmark Button