# Help with numerical values

**URL:** <https://forum.kirupa.com/t/help-with-numerical-values/64170>\
**Category:** flash\
**Created:** [September 13, 2004, 8:58pm UTC](https://forum.kirupa.com/t/help-with-numerical-values/64170 "2004-09-13T20:58:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sixfortyfive](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/sixfortyfive/32/671_2.png) [@sixfortyfive](https://forum.kirupa.com/u/sixfortyfive)\
**Post date:** [September 13, 2004, 8:58pm UTC](https://forum.kirupa.com/t/help-with-numerical-values/64170/1 "2004-09-13T20:58:13Z")

</div>

This ActionScript is creating reading an XML file, and laying out thumbnail images. I’m stuck though! Each thumbnail is given a value of thumbnail[x], going from 0-5. \*\*I wrote some mouse actions and need to access each thumbnail’s number, not entire name (where I have it in red below). \*\*

“this” actually equals “thumbnails.thumbnail0”, “thumbnails.thumbnail1”, etc. But I need just the # on the end of that.

Can any AS guru’s out there help me?

```auto
myPhoto = new XML();
 myPhoto.ignoreWhite = true;
 myPhoto.onLoad = function(success) {
 	numimages = this.firstChild.childNodes.length;
 	spacing = 62;
 	for (i=0; i<numimages; i++) {
 		picHolder = this.firstChild.childNodes*;
 		thumbHolder = thumbnails.createEmptyMovieClip("thumbnail"+i, i);
 		thumbHolder._x = i*spacing;
 		thumbLoader = thumbholder.createEmptyMovieClip("thumbnail_image", 0);
 		thumbLoader.loadMovie(picHolder.attributes.thmb);
 		thumbHolder.title = picHolder.attributes.title;
 		thumbHolder.main = picHolder.attributes.main;
  
 		thumbHolder.onRelease = function() {
 			closeoutOver([color=Red]this[/color]);
 			loader.box.loadMovie(this.main);
 			over.over([color=Red]this[/color]).gotoAndStop(3);
 		};
 
 		thumbHolder.onRollover = function() {
 		if (over.over([color=Red]this[/color])._currentframe == 3) {
 			over.over([color=Red]this[/color]).stop();
 		}else{	
 			over.over([color=Red]this[/color]).gotoAndStop(2);
 		}
 		};
 
 		thumbHolder.onRollout = function() {
 		if (over.over([color=Red]this[/color])._currentframe == 3) {
 			over.over([color=Red]this[/color]).stop();
 		}else{	
 			over.over([color=Red]this[/color]).gotoAndStop(1);
 		}
 		};
 }
 
 }

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 14, 2004, 3:00am UTC](https://forum.kirupa.com/t/help-with-numerical-values/64170/2 "2004-09-14T03:00:50Z")

</div>

hi,

I haven’t look at all of your code… so I’m not sure if this is it. If it isn’t, you should be able to get the idea:

```auto

for (i = 0; i < numimages; i++) {
	picHolder = this.firstChild.childNodes*;
	thumbHolder = thumbnails.createEmptyMovieClip("thumbnail" + i, i);
	// store the variable i in each movie clip
	thumbHolder.i = i;
	// more of your code here...
	thumbHolder.onRelease = function()
	{
		// you can call the interger you wish with this.i
		trace(this.i);
		// more of your code here...
	};
}

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 14, 2004, 2:07pm UTC](https://forum.kirupa.com/t/help-with-numerical-values/64170/3 "2004-09-14T14:07:06Z")

</div>

thanks numomira! It works, except I can’t the following to work:

```auto
thumbHolder.onRollover = function() {
 trace(over("over"+this.i).hello);
 };

```

I want it to return “over.over0.hello” with the value of this.i in the 2nd occurance of the word “over”. I probably have the syntax wrong.

Can anyone help?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 14, 2004, 2:35pm UTC](https://forum.kirupa.com/t/help-with-numerical-values/64170/4 "2004-09-14T14:35:13Z")

</div>

Square brackets:

```auto

thumbHolder.onRollover = function() {
 trace(over["over"+this.i].hello);
 };

```

Read [dynamic references](http://www.nunomira.com/tutorials/dynamic_references.php) for more details.
