# Targeting variable mc's

**URL:** <https://forum.kirupa.com/t/targeting-variable-mcs/20486>\
**Category:** flash\
**Created:** [May 9, 2003, 3:40am UTC](https://forum.kirupa.com/t/targeting-variable-mcs/20486 "2003-05-09T03:40:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![CadmiumFly](https://avatars.discourse-cdn.com/v4/letter/c/edb3f5/32.png) [@CadmiumFly](https://forum.kirupa.com/u/CadmiumFly)\
**Post date:** [May 9, 2003, 3:40am UTC](https://forum.kirupa.com/t/targeting-variable-mcs/20486/1 "2003-05-09T03:40:05Z")

</div>

I’ve tried everything. Help would be greatly appreciated!!  
Question: How do you target a movieclip instance that was named with a variable? eg…

whichPic=1;  
Pictures=10;

–frame2  
onEnterFrame = function()  
{if(\_root.whichPic\<\_root.Pictures)  
{attachMovie(“Picholder”, “Picholder”+\_root.whichPic, \_root.Depther);  
gotoAndPlay(3);}else{stop();}

–frame3  
???“Picholder”+\_root.whichPic.\_set\_some\_type\_of\_property???  
\_root.whichPic++;  
\_root.Depther++;  
gotoAndPlay(2);

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 9, 2003, 6:08am UTC](https://forum.kirupa.com/t/targeting-variable-mcs/20486/2 "2003-05-09T06:08:24Z")

</div>

try [“Picholder”+whichPic].\_width = 100;

if that doesnt work (but i belive it should), then try

\_root[“Picholder”+whichPic].\_width = 100;

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 9, 2003, 5:47pm UTC](https://forum.kirupa.com/t/targeting-variable-mcs/20486/3 "2003-05-09T17:47:41Z")

</div>

I gave that a shot. No go… These actions are in a mc on the stage. the variable “whichPic” is held in \_root. I’ve tried:  
[“Picholder”+\_root.whichPic].\_width = 100; and combinations of the like, but they didn’t work either. I’ll keep on playing…  
Thanks for the help!!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 9, 2003, 9:58pm UTC](https://forum.kirupa.com/t/targeting-variable-mcs/20486/4 "2003-05-09T21:58:22Z")

</div>

if you send me your FLA i could take a look at it.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 9, 2003, 10:10pm UTC](https://forum.kirupa.com/t/targeting-variable-mcs/20486/5 "2003-05-09T22:10:07Z")

</div>

thanks, I figured it out. At least worked around it if nothing else… I put the value for the property I wanted to set in the mc in the library, so when each one was attached, it loaded with that value.  
Thanks for the help!
