# Flash MX ComboBox

**URL:** <https://forum.kirupa.com/t/flash-mx-combobox/514>\
**Category:** flash\
**Created:** [July 20, 2002, 2:57am UTC](https://forum.kirupa.com/t/flash-mx-combobox/514 "2002-07-20T02:57:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![niisa](https://avatars.discourse-cdn.com/v4/letter/n/9dc877/32.png) [@niisa](https://forum.kirupa.com/u/niisa)\
**Post date:** [July 20, 2002, 2:57am UTC](https://forum.kirupa.com/t/flash-mx-combobox/514/1 "2002-07-20T02:57:33Z")

</div>

I want to use the combobox function that MX has, but how do script it?  
The one that I’ve got from the help site is quite vague(I guess that is why I spent more time in flashkit and kirupa more than Macromedia site, even the help-forum is not that user friendly{personal commnets}), that is

function onChange(component){  
if (componet.\_name==“check1”){  
listBox1\_mc.setEnabled(componet.getValue());{  
else\_if (componet.\_name==“check2”){  
listBox2\_mc.setEnabled(componet.getValue());}  
}

I would understand that this could be a lenghty subject, maybe somebody could guide me to a place that I could get a tutorial?

---

<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:** [July 20, 2002, 4:28am UTC](https://forum.kirupa.com/t/flash-mx-combobox/514/2 "2002-07-20T04:28:36Z")

</div>

What does this have to do with a combobox ?

pom :asian:

By the way, I have a tutorial on the way…

---

<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:** [July 20, 2002, 4:54am UTC](https://forum.kirupa.com/t/flash-mx-combobox/514/3 "2002-07-20T04:54:38Z")

</div>

Well I thought that was the code…(duh)

How to code it so that I can use ComboBox? Whats the use of Flash UI components if I cannot even find the correct code to use it? Macromedia site only give gibberish that I do not know which is the code and which is the variables.

ilyaslamasse, can you help me with the codes, I’m using comboBox.

BTW, how’s your class? Hope it does not go as you expected!(tough, I mean)

---

<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:** [July 20, 2002, 10:22am UTC](https://forum.kirupa.com/t/flash-mx-combobox/514/4 "2002-07-20T10:22:11Z")

</div>

OK. Just drag a combobox on your scene, and give it the instance name **birth**. Then in the first FRAME of your movie, put this code :

```auto
// populate the combobox
for (i=1970;i<1990;i++) {
	birth.addItem (i) ;
}
// function to display the selection
function comboDisplay (component) {
	trace ( component.getSelectedItem().label );
}
// We assign the function to the combobox
birth.setChangeHandler ("comboDisplay") ;

```

You can also link each label (here a number) to a data, and use that data in the comboDisplay function.

The classes are peachy by the way =) for now…

Cheers! pom :asian:

---

<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:** [July 22, 2002, 5:28am UTC](https://forum.kirupa.com/t/flash-mx-combobox/514/5 "2002-07-22T05:28:28Z")

</div>

I have to try it that way. To tell you the truth… the way I have used it is more similar to niisa’s code…

hmm… different ways to use the “force” you have

---

<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:** [July 22, 2002, 8:31am UTC](https://forum.kirupa.com/t/flash-mx-combobox/514/6 "2002-07-22T08:31:40Z")

</div>

OK, OK, I wasn’t trying to answer a particular question, but merely trying to give an example of a code that one could put for a Combobox.

Now in the first code, there’s check1, check2 (checkboxes ?), listboxes but no combobox… What are you trying to do exactly, niisa ?

pom :asian:

---

<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:** [July 23, 2002, 6:45am UTC](https://forum.kirupa.com/t/flash-mx-combobox/514/7 "2002-07-23T06:45:04Z")

</div>

I have went to more indepth and found the answer that I am looking for, apparently not that easy. The code up there is not what I want to achieve. It is this one…

function getResults() {  
var1 = combo\_box.getSelectedItem().label;  
selectedItem = color\_box.getSelectedIndex();  
var2 = combo\_box.getSelectedItem().data;  
selectedItem = color\_box.getSelectedIndex();  
}

inwhich var1 is for displayed selection and var2 is for calculation.  
BTW anybody knows why you need…

selectedItem = color\_box.getSelectedIndex();

in the code
