# Parameter?

**URL:** <https://forum.kirupa.com/t/parameter/311036>\
**Category:** Uncategorized\
**Created:** [June 25, 2010, 7:51pm UTC](https://forum.kirupa.com/t/parameter/311036 "2010-06-25T19:51:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pandaforever](https://avatars.discourse-cdn.com/v4/letter/p/8dc957/32.png) [@pandaforever](https://forum.kirupa.com/u/pandaforever)\
**Post date:** [June 25, 2010, 7:51pm UTC](https://forum.kirupa.com/t/parameter/311036/1 "2010-06-25T19:51:44Z")

</div>

this function is use to generate characters, is there anyway to generate character by passing in a parameter instead of check with if statements?

function charcheck() {  
for (i=2; i\<9; i++) {  
com = new c1();  
com.x = (i-1)\*90;  
com.y=280;  
com.name=“com”+i;  
addChild(com);  
}  
if (myglobal.character==1) {  
for (i=2; i\<9; i++) {  
var ac:b1 = new b1();  
ac.x = (i-1)\*95;  
ac.y=200;  
ac.name=“ac”+i;  
addChild(ac);  
}  
var ac8=getChildByName(“ac8”);  
ac8.addEventListener(MouseEvent.MOUSE\_DOWN, ac8a);  
ac8.addEventListener(MouseEvent.MOUSE\_UP, ac8b);  
}  
if (myglobal.character==2) {  
for (i=2; i\<9; i++) {  
var bc:b2 = new b2();  
bc.x = (i-1)\*95;  
bc.y=200;  
bc.name=“bc”+i;  
addChild(bc);  
}  
}  
if (myglobal.character==3) {  
for (i=2; i\<9; i++) {  
var cc:b3 = new b3();  
cc.x = (i-1)\*95;  
cc.y=200;  
cc.name=“cc”+i;  
addChild(cc);  
}  
}  
if (myglobal.character==4) {  
for (i=2; i\<9; i++) {  
var dc:b4 = new b4();  
dc.x = (i-1)\*95;  
dc.y=200;  
dc.name=“dc”+i;  
addChild(dc);  
}  
}  
if (myglobal.character==5) {  
for (i=2; i\<9; i++) {  
var ec:b5 = new b5();  
ec.x = (i-1)\*95;  
ec.y=200;  
ec.name=“ec”+i;  
addChild(ec);  
}  
}  
if (myglobal.character==6) {  
for (i=2; i\<9; i++) {  
var fc:b6 = new b6();  
fc.x = (i-1)\*95;  
fc.y=200;  
fc.name=“fc”+i;  
addChild(fc);  
}  
}  
}
