# AS 3.0 help with case switch array

**URL:** <https://forum.kirupa.com/t/as-3-0-help-with-case-switch-array/238066>\
**Category:** flash\
**Created:** [September 6, 2007, 9:39pm UTC](https://forum.kirupa.com/t/as-3-0-help-with-case-switch-array/238066 "2007-09-06T21:39:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![echowalker](https://avatars.discourse-cdn.com/v4/letter/e/c67d28/32.png) [@echowalker](https://forum.kirupa.com/u/echowalker)\
**Post date:** [September 6, 2007, 9:39pm UTC](https://forum.kirupa.com/t/as-3-0-help-with-case-switch-array/238066/1 "2007-09-06T21:39:33Z")

</div>

I’m new to this forum and am trying to do something in flash that my collegues at work say is not possible, but I know it is, so here it goes.

I have AS 3.0 code that allows a user to select multiple radio buttons and depending on  
what they select I have a gotoAndStop/Play event on certain buttons.

Problem:  
my issue is that I want them to be able to select- for example “btn 1-3-2 or 5-8-3-2-4” and depending on which button they selct will take them to a certain frame.

this is what my radio buttons script looks like:

var rbL:Object = {};  
rbL.click = function(obj:Object){  
var sel = obj.target;  
var dat = sel.data;  
trace(sel+" - data - “+dat);  
arr.push(dat);  
};  
////this gives me 6 buttons to choose from\  
[COLOR=“Red”]for(var n:Number=1; n!=6; n++){[/COLOR]  
var init:Object = {\_x:50, _y:n\*40+280, label:n, data:n, groupName:“rb”+n};  
var ref:MovieClip = this.attachMovie(“RadioButton”, "RB_”+n, n+1000, init);  
ref.addEventListener(“click”, rbL);  
}

this.attachMovie(“Button”,“btnSubmit”,2000,{\_x:75, \_y:675, label:“Design Studio”});

var Submit:Object = {};  
Submit.click = function(){  
var str:String = “”;  
[COLOR=“SeaGreen”]for(var m:Number=0; m!=5; m++){[/COLOR]  
[COLOR="#ff0000"]///// notice- it takes first 5 entries only, but I would like to be able to pick less then 5 or more///////[/COLOR]  
str += arr[m];  
}  
[COLOR=“MediumTurquoise”]switch(str){  
case “12345”:  
\_root.gotoAndStop(“vocal1”);  
break;  
case “21” :  
\_root.gotoAndStop(“vocal2”);  
break;  
case “231” :  
\_root.gotoAndPlay(“studio1”);  
break;[/COLOR]

So when I publish/compile I am only able to select 5 buttons no more and no less.  
I would like to be able to have a user select ANY NUMBER OF COMBINATIONS, not only 5 radio buttons but maybe 3 or 2 if they want.  
Any help is appreciated-- I can return the favor via audio services, I am professional musician and had a hit in 1998–long ago I know.

Thanks Echowalker
