# Get var name after loop

**URL:** https://forum.kirupa.com/t/get-var-name-after-loop/286124
**Category:** Uncategorized
**Created:** [April 10, 2009, 12:32pm UTC](https://forum.kirupa.com/t/get-var-name-after-loop/286124 "2009-04-10T12:32:37Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Deborah](https://avatars.discourse-cdn.com/v4/letter/d/6f9a4e/32.png) [@Deborah](https://forum.kirupa.com/u/Deborah)
#### Post date: [April 10, 2009, 12:32pm UTC](https://forum.kirupa.com/t/get-var-name-after-loop/286124/1 "2009-04-10T12:32:37Z")

</div>

I have a loop that loads sprites from an array into a container. Which sprites get loaded depends on which button was clicked.

I need to change the individual sprite color when a user selects a color swatch.

I know the names of the sprite variables but I need a dynamic way to select them to be changed (since they were loaded dynamically).

For example my Container _might_ have the following children:  
headerv1  
sidebarv1  
footerv2.

the color change affects each element differently. ie.  
header elements change to header color;  
footer elements change to footer color, etc.

I need a more dynamic solution to change the color (because the header element might actually be headerv4.

root[“headerv1”].transform.colorTransform = headerColor;

Any help is appreciated!  
Deborah
