PDA

View Full Version : Rerring to my clip by name?



Alber Kidd
March 15th, 2009, 12:29 PM
Hi,

I have created a loop to add my clips by class and give them a name

tempClip = new clientsThumbs[i]();
tempClip.x = xPos;
tempClip.y = yPos;
tempClip.name = clientsNames[i];
tempClip.addEventListener(MouseEvent.CLICK, focus);
addChild(tempClip);
xPos = xPos +200;

Then I want to loop through these clips and change the alpha, I have tried casting as I thought that was how you do it but I get the 'cannot convert string' error



for(var i:int = 0; i<clientsName.length; i++) {

clientsNames[i].alpha= 0.5;

//OR MovieClip(clientsNames[i]).alpha= 0.5;

}

How do I reference my instances by name
http://www.kirupa.com/forum/styles/kirupaProblue/statusicon/user_online.gif http://www.kirupa.com/forum/styles/kirupaProblue/buttons/report.gif (http://www.kirupa.com/forum/report.php?p=2447952) http://www.kirupa.com/forum/styles/kirupaProblue/misc/progress.gif http://www.kirupa.com/forum/styles/kirupaProblue/buttons/edit.gif (http://www.kirupa.com/forum/editpost.php?do=editpost&p=2447952)

Krilnon
March 15th, 2009, 12:58 PM
getChildByName(clientsNames[i])