# Using the combobox component

**URL:** <https://forum.kirupa.com/t/using-the-combobox-component/6425>\
**Category:** Uncategorized\
**Created:** [October 7, 2002, 10:04am UTC](https://forum.kirupa.com/t/using-the-combobox-component/6425 "2002-10-07T10:04:52Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![j0se](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/j0se/32/44_2.png) [@j0se](https://forum.kirupa.com/u/j0se)\
**Post date:** [October 7, 2002, 10:04am UTC](https://forum.kirupa.com/t/using-the-combobox-component/6425/1 "2002-10-07T10:04:52Z")

</div>

hello all,

ok, i have a combobox component with some values: val1, val2

when user clicks a value i want to move the playhead to a frame where the contect will be shown

this would be the pseudo code for it:

# === if val1 gotoAndStop(1); set the combobox to show val1;

i’ve set up the changeHandler and i’ve added my function to the first keyframe of the movie - it’s just the syntax i’m struggling with

can anybody help me with the actionscript please?

cheers

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 7, 2002, 12:39pm UTC](https://forum.kirupa.com/t/using-the-combobox-component/6425/2 "2002-10-07T12:39:47Z")

</div>

onChange = function (mycombo){

if(mycombo.getselecteditem().label==val1){  
do this or do that;  
}

it could be getselecteditem().label or getselecteditem().data for example…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 7, 2002, 1:16pm UTC](https://forum.kirupa.com/t/using-the-combobox-component/6425/3 "2002-10-07T13:16:03Z")

</div>

Exactly. And to avoid the ifs, you can use switch/case:

```auto
onChange = function (mycombo){
   var myVal=mycombo.getselecteditem().label;
   switch (myVal){
      case val1: //something
           break;
      case val2: //something else
           break;
   }      
}

```

Just a thought.

pom 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 7, 2002, 2:06pm UTC](https://forum.kirupa.com/t/using-the-combobox-component/6425/4 "2002-10-07T14:06:38Z")

</div>

just like old times, Pom. 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 7, 2002, 2:43pm UTC](https://forum.kirupa.com/t/using-the-combobox-component/6425/5 "2002-10-07T14:43:00Z")

</div>

Haha!! 😛

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 7, 2002, 10:08pm UTC](https://forum.kirupa.com/t/using-the-combobox-component/6425/6 "2002-10-07T22:08:40Z")

</div>

cheers guys - that works fine!

Much appreciated  
🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 13, 2002, 9:45pm UTC](https://forum.kirupa.com/t/using-the-combobox-component/6425/7 "2002-10-13T21:45:12Z")

</div>

how do i set the combobox component to show a particular label when i click a button?

i don’t know the methods of the combobox otherwise i’d play about with it until i got it right  
☹

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 14, 2002, 1:28am UTC](https://forum.kirupa.com/t/using-the-combobox-component/6425/8 "2002-10-14T01:28:25Z")

</div>

Jose, all the methods are in the reference panel and in the actionscript dictionary. It would serve you well to look them up, for you may see system capabilities that you were not aware of, and that we may not mention unless you ask.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 14, 2002, 7:14pm UTC](https://forum.kirupa.com/t/using-the-combobox-component/6425/9 "2002-10-14T19:14:10Z")

</div>

i’ve never seen the reference panel before! (i still haven’t fully explored the menu)

i can see all the methods now! (the gets and the sets)  
🙂

thanks Iammontoya!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 15, 2002, 2:29am UTC](https://forum.kirupa.com/t/using-the-combobox-component/6425/10 "2002-10-15T02:29:21Z")

</div>

🙂
