# Code + ComboBox

**URL:** <https://forum.kirupa.com/t/code-combobox/307784>\
**Category:** flash\
**Created:** [April 10, 2010, 6:11am UTC](https://forum.kirupa.com/t/code-combobox/307784 "2010-04-10T06:11:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Emadigon](https://avatars.discourse-cdn.com/v4/letter/e/f4b2a3/32.png) [@Emadigon](https://forum.kirupa.com/u/Emadigon)\
**Post date:** [April 10, 2010, 6:11am UTC](https://forum.kirupa.com/t/code-combobox/307784/1 "2010-04-10T06:11:12Z")

</div>

[FONT=Times New Roman][SIZE=3]I’ve added a combo box to the stage,[/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3]In the combo box properties\ Parameters tab, I’ve entered some data.[/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3]snd\_1, snd\_2, snd\_3, etc[/SIZE][/FONT]  
[SIZE=3][FONT=Times New Roman]// myCombo [/FONT][/SIZE]  
[SIZE=3][FONT=Times New Roman]var bigEars:Object = new Object();[/FONT][/SIZE]  
[SIZE=3][FONT=Times New Roman]myCombo.addEventListener(“change”,bigEars);[/FONT][/SIZE]  
[SIZE=3][FONT=Times New Roman]bigEars.change = function() {trace(\_root.myCombo.selectedItem.data);}[/FONT][/SIZE]

[FONT=Times New Roman][SIZE=3]Works fine, trace output shows the selected combobox item. snd\_1, snd\_2, snd\_3, etc[/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3]I’m having trouble using this returned item in a statement.[/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3]\_root.[COLOR=seagreen]snd\_ch1[/COLOR].start(0,20); plays a sound[/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3]\_root.[COLOR=seagreen]myCombo.selectedItem.data[/COLOR].start(0,20); doesn’t play a sound[/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3][/SIZE][/FONT]  
Edit  
Sorry I should have explained,  
In my Library I have a sound file called ch1.WAV  
It has Linkage Properties Identifier ch1  
I used a bit of code …  
var snd\_ch1 = new Sound()  
snd\_ch1.attachSound(“ch1”)  
End Edit

[SIZE=3][FONT=Times New Roman]My problem is not so much a combo box problem, it’s more of a code problem.[/FONT][/SIZE]  
All help much appreciated
