# There's got to be a better way

**URL:** <https://forum.kirupa.com/t/theres-got-to-be-a-better-way/330182>\
**Category:** Uncategorized\
**Created:** [December 11, 2012, 2:08pm UTC](https://forum.kirupa.com/t/theres-got-to-be-a-better-way/330182 "2012-12-11T14:08:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dogblz](https://avatars.discourse-cdn.com/v4/letter/d/5e9695/32.png) [@dogblz](https://forum.kirupa.com/u/dogblz)\
**Post date:** [December 11, 2012, 2:08pm UTC](https://forum.kirupa.com/t/theres-got-to-be-a-better-way/330182/1 "2012-12-11T14:08:02Z")

</div>

Thinking about using a switch statement for 32 different buttons like this one:  
function chooseStudent(e:MouseEvent):void {  
switch (e.currentTarget.name) {  
case “student1”:  
currStudent = “./”+studentList[0]+"/"+studentList[0]+".swf" as String;  
var myURL:URLRequest=new URLRequest(currStudent);  
myProLoader.load(myURL);  
addChild(myProLoader);  
break;  
}  
}  
student 1 through student 32 getting info from an array with their names and loading a SWF.

Am I just lazy, or is there a more efficient way to do this rather than create 32 case statements?

Thanks,  
Dave…
