# How to make this count?

**URL:** <https://forum.kirupa.com/t/how-to-make-this-count/203849>\
**Category:** flash\
**Created:** [October 14, 2006, 9:21pm UTC](https://forum.kirupa.com/t/how-to-make-this-count/203849 "2006-10-14T21:21:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bennymartensson](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/bennymartensson/32/1317_2.png) [@bennymartensson](https://forum.kirupa.com/u/bennymartensson)\
**Post date:** [October 14, 2006, 9:21pm UTC](https://forum.kirupa.com/t/how-to-make-this-count/203849/1 "2006-10-14T21:21:35Z")

</div>

How do I write this to load the appropriate image? I want to load the same number as the button I click on. Now I have a trace action where the loading should occur and that only show that I’m loading image number 15 all the time. Anyone?

```auto

function hitButton(nbrID) {
	btn = _root["btn"+nbrID];
	btn.nbrID = nbrID;
	btn.onRollOver = function() {
		this.alphaTo(100, .5);
		}
	btn.onRollOut = function() {
		this.alphaTo(30, .5);
		}
	btn.onRelease = function() {
		trace (["bilder/" +i] + ".jpg");
		btn1._alpha = 30;
		btn1.enabled = true;
		for (var i = 2; i<15; i++) {
        	_root["btn"+i]._alpha = 30;
			_root["btn"+i].enabled = true;
    		this._alpha = 100;
			this.enabled = false;
		}
	}
}

for (var i = 1; i<15; i++) {
_root.hitButton(i);
}

```
