# Dynamic pathing to a nested MC

**URL:** <https://forum.kirupa.com/t/dynamic-pathing-to-a-nested-mc/151515>\
**Category:** Uncategorized\
**Created:** [June 15, 2005, 11:25pm UTC](https://forum.kirupa.com/t/dynamic-pathing-to-a-nested-mc/151515 "2005-06-15T23:25:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![joakimlinden](https://avatars.discourse-cdn.com/v4/letter/j/51bf81/32.png) [@joakimlinden](https://forum.kirupa.com/u/joakimlinden)\
**Post date:** [June 15, 2005, 11:25pm UTC](https://forum.kirupa.com/t/dynamic-pathing-to-a-nested-mc/151515/1 "2005-06-15T23:25:29Z")

</div>

I wonder if there is a “neat” way of creating onRollOver functions for a bunch of mc’s with a for loop?

Imagine a \_root with four boxes. Each box contains a “dummy mc” that will be used as a hit area for the mouse.

So you roll over the invisible dummy inside box03 in \_root and within the onRollOver function a tween is fired that scales up the box03 to 120%. You roll out, the box goes back to 100%.

In code:  
\_root.box03.frame03.onRollOver = function () {  
\_root.box03.scaleTo(120,1,);  
}

Can I turn this into a “for loop” so that I don’t have to duplicate the code for each instance? I can probably do it if it’s on level deep, but I don’t know the syntax for accessing a clip that is two levels deep…  
one level deep for loop: \_root[“box0”+i].onRollOver

Am I clear?
