# String Manipulation in Function

**URL:** <https://forum.kirupa.com/t/string-manipulation-in-function/198188>\
**Category:** flash\
**Created:** [August 23, 2006, 1:29am UTC](https://forum.kirupa.com/t/string-manipulation-in-function/198188 "2006-08-23T01:29:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rumoroso](https://avatars.discourse-cdn.com/v4/letter/r/ecc23a/32.png) [@rumoroso](https://forum.kirupa.com/u/rumoroso)\
**Post date:** [August 23, 2006, 1:29am UTC](https://forum.kirupa.com/t/string-manipulation-in-function/198188/1 "2006-08-23T01:29:39Z")

</div>

I’m using a function to call multiple button actions, so I don’t have to rewrite code for each button… here’s the script:

```auto
function btnSelect(num){
	var btnA = "btn" + num;
	btnA.onRelease = function(){
		if (loaded == filesize) {
		picture._alpha = 0;
		picture.loadMovie(image[num], 1);
		desc_txt.text = description[num];
		picture_num();
		}
	}
}
btnSelect("0");
btnSelect("1");
btnSelect("2");
btnSelect("3");
btnSelect("4");

```

This is all part of a clip which loads pictures externally… each of the buttons (which are mc’s) are named btn0, btn1, etc… any ideas how to make this work??
