# If/Var Statement Help Please

**URL:** <https://forum.kirupa.com/t/if-var-statement-help-please/281589>\
**Category:** flash\
**Created:** [February 11, 2009, 1:02am UTC](https://forum.kirupa.com/t/if-var-statement-help-please/281589 "2009-02-11T01:02:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![junta](https://avatars.discourse-cdn.com/v4/letter/j/ee59a6/32.png) [@junta](https://forum.kirupa.com/u/junta)\
**Post date:** [February 11, 2009, 1:02am UTC](https://forum.kirupa.com/t/if-var-statement-help-please/281589/1 "2009-02-11T01:02:47Z")

</div>

I have 10 buttons (button0, button1, button2, etc.) and when you click on one of the buttons I want the corresponding jpg (0.jpg, 1.jpg, 2.jpg, etc.) to load externally into the movie clip “holder” that is on the stage. Here is my code:

```auto

for (var i:Number = 0; i < 10 ; i++)
{
	Target["button" + i].onRelease = function()
	{
		if( !this.up ){
			loadMovie(i+".jpg", "holder")};
		}
	}

```

If I click on button10, the image does load, but if I click on any others they don’t load. If I change i\<10 to i\<1, then button1 loads. I am not sure why this is happening. Any clue?? Thanks a bunch…
