# Instances and Variables

**URL:** <https://forum.kirupa.com/t/instances-and-variables/303625>\
**Category:** flash\
**Created:** [January 23, 2010, 5:16pm UTC](https://forum.kirupa.com/t/instances-and-variables/303625 "2010-01-23T17:16:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rowan\_E](https://avatars.discourse-cdn.com/v4/letter/r/439d5e/32.png) [@Rowan\_E](https://forum.kirupa.com/u/Rowan_E)\
**Post date:** [January 23, 2010, 5:16pm UTC](https://forum.kirupa.com/t/instances-and-variables/303625/1 "2010-01-23T17:16:02Z")

</div>

I have a .as file with all my code etc in it, and a setup of movieclips (all correctly named) on the corresponding .fla file. How can I access a nested movieclip in a repeating loop? I’ve seen things such as ‘just use an array’ (that returns coercion of String) or 'use this[blah] (which expects a definition). There has to be a simple way of doing this, but I can’t find it. Any help?

Code I have now is:

function LegendSetup() {  
for (var i:int=1; i\<=$NumLegendButtons; i++) {  
$LegendCompiler = “mci\_Legend.mci\_LI” + i + “.bi\_LB” + i;  
MovieClip(root).mci\_Legend.$LegendCompiler.alpha=0;  
}  
}
