# Change sub mcs' visible property using "for loop" problem

**URL:** <https://forum.kirupa.com/t/change-sub-mcs-visible-property-using-for-loop-problem/328226>\
**Category:** Uncategorized\
**Created:** [April 29, 2012, 7:52pm UTC](https://forum.kirupa.com/t/change-sub-mcs-visible-property-using-for-loop-problem/328226 "2012-04-29T19:52:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lionminister](https://avatars.discourse-cdn.com/v4/letter/l/f04885/32.png) [@lionminister](https://forum.kirupa.com/u/lionminister)\
**Post date:** [April 29, 2012, 7:52pm UTC](https://forum.kirupa.com/t/change-sub-mcs-visible-property-using-for-loop-problem/328226/1 "2012-04-29T19:52:42Z")

</div>

hi. just like in the pic, i have 2 buttons on the stage plus and minus and there is a mc called submc in the stage. and there are 10 other mc in the sub mc.  
i like to add and remove 10 mc one by one with the buttons in the stage but i can’t get it with for loop. every single hit on the minus button add one mc on the submc movieclip.

pic url:  
[upload.omeraslanbakan.com/soru.jpg](http://upload.omeraslanbakan.com/soru.jpg)

this is the code i use:

btn\_plus.addEventListener(MouseEvent.CLICK, mcFramePlus);  
btn\_minus.addEventListener(MouseEvent.CLICK, mcFrameMinus);

function mcFramePlus(Event:MouseEvent):void  
{  
var i:uint = new uint  
for(i=1; i\<11; i++)  
{  
MovieClip(submc).mc\*.visible = true  
}  
}

function mcFrameMinus(Event:MouseEvent):void  
{  
var i:uint = new uint  
for(i=1; i\<11; i–)  
{  
MovieClip(submc).mc\*.visible = false  
}  
}

i can’t add the movieclips that’s a problem and i dont know how to remove the last added mc’s with minus button.  
sorry for bad english.
