# Storing values in multiple loops

**URL:** <https://forum.kirupa.com/t/storing-values-in-multiple-loops/264702>\
**Category:** Uncategorized\
**Created:** [June 29, 2008, 2:13am UTC](https://forum.kirupa.com/t/storing-values-in-multiple-loops/264702 "2008-06-29T02:13:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![geestring](https://avatars.discourse-cdn.com/v4/letter/g/e19b73/32.png) [@geestring](https://forum.kirupa.com/u/geestring)\
**Post date:** [June 29, 2008, 2:13am UTC](https://forum.kirupa.com/t/storing-values-in-multiple-loops/264702/1 "2008-06-29T02:13:48Z")

</div>

for (var s = 0; s\<mainSections.length; s++) { //grabbing the fabric types Handblocks,Screenprints,and Wovens

for (var i = 0; i\<subSection.length; i++) { //grabbing each fabric design of the fabric type

for (var d = 0; d\<matSection.length; d++) {//grabs each material type sub section of each fabric design

for (var t = 0; t\<startThumbs.length; t++) {//finally processing the thumbs within the material type section.

I have these forloops going through an xml file. getting each section, sub section… eventually getting to the actuall fabric and thumbnail.

So in the last forloop is where I load the thumbs. When the person clicks a thumb I want to record the values of s i d… t I can store in a holder variable but the rest I dont know how to record.

Essentially I want to know what thumb the person clicked.

---

<div class="post-metadata">

**Author:** ![TheCanadian](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@TheCanadian](https://forum.kirupa.com/u/TheCanadian)\
**Post date:** [June 29, 2008, 2:17am UTC](https://forum.kirupa.com/t/storing-values-in-multiple-loops/264702/2 "2008-06-29T02:17:56Z")

</div>

When you create your holder movie clip, you would set them all as properties of that clip. Something like:

```auto
var mc:MovieClip = createEmptyMovieClip(/*arguments*/);
mc.s = s;
mc.i = i;
mc.d = d;
mc.t = t;

```

---

<div class="post-metadata">

**Author:** ![dlgamer](https://avatars.discourse-cdn.com/v4/letter/d/7993a0/32.png) [@dlgamer](https://forum.kirupa.com/u/dlgamer)\
**Post date:** [June 29, 2008, 2:20am UTC](https://forum.kirupa.com/t/storing-values-in-multiple-loops/264702/3 "2008-06-29T02:20:49Z")

</div>

I am not familiar with xml but I am assuming you are using xml in a flash movie? I would try this:

```auto
var clickedThumbs:Array = new Array();

for (var t = 0; t<startThumbs.length; t++) {    
    startThumbs[t].onRelease = function() {
        clickedTumbs.push(this);
    }
}

```

---

<div class="post-metadata">

**Author:** ![geestring](https://avatars.discourse-cdn.com/v4/letter/g/e19b73/32.png) [@geestring](https://forum.kirupa.com/u/geestring)\
**Post date:** [June 29, 2008, 3:48am UTC](https://forum.kirupa.com/t/storing-values-in-multiple-loops/264702/4 "2008-06-29T03:48:20Z")

</div>

[QUOTE=TheCanadian;2350841]When you create your holder movie clip, you would set them all as properties of that clip. Something like:

```auto
var mc:MovieClip = createEmptyMovieClip(/*arguments*/);
mc.s = s;
mc.i = i;
mc.d = d;
mc.t = t;

```

[/QUOTE]

thanks this worked. I didnt know s,i, and d were accessible from within the child forloop.

---

<div class="post-metadata">

**Author:** ![TheCanadian](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@TheCanadian](https://forum.kirupa.com/u/TheCanadian)\
**Post date:** [June 29, 2008, 7:53am UTC](https://forum.kirupa.com/t/storing-values-in-multiple-loops/264702/5 "2008-06-29T07:53:53Z")

</div>

Glad to help :hoser:
