# ComboBox Q

**URL:** <https://forum.kirupa.com/t/combobox-q/116833>\
**Category:** Uncategorized\
**Created:** [July 21, 2004, 7:19pm UTC](https://forum.kirupa.com/t/combobox-q/116833 "2004-07-21T19:19:52Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![fatnslow](https://avatars.discourse-cdn.com/v4/letter/f/7993a0/32.png) [@fatnslow](https://forum.kirupa.com/u/fatnslow)\
**Post date:** [July 21, 2004, 7:19pm UTC](https://forum.kirupa.com/t/combobox-q/116833/1 "2004-07-21T19:19:52Z")

</div>

Hey, I wonderd if it was possible to do so when clicking on one of the options in the ComboBox, it could load an .swf into an container?

Maybe with:

```auto
container.loadMovie("sound.swf");

```

Or something…

Thanks,  
fatnslow

---

<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 21, 2004, 10:15pm UTC](https://forum.kirupa.com/t/combobox-q/116833/2 "2004-07-21T22:15:28Z")

</div>

Anyone?

---

<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 21, 2004, 10:17pm UTC](https://forum.kirupa.com/t/combobox-q/116833/3 "2004-07-21T22:17:17Z")

</div>

nope, dont know how to do that…

---

<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, 2004, 6:55pm UTC](https://forum.kirupa.com/t/combobox-q/116833/4 "2004-07-22T18:55:41Z")

</div>

have you checked the FMX default help files?  
surely there is something like comboBox.onChange…??

Prophet.

---

<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, 2004, 10:24pm UTC](https://forum.kirupa.com/t/combobox-q/116833/5 "2004-07-22T22:24:49Z")

</div>

Couldn’t find it…

---

<div class="post-metadata">

**Author:** ![fatnslow](https://avatars.discourse-cdn.com/v4/letter/f/7993a0/32.png) [@fatnslow](https://forum.kirupa.com/u/fatnslow)\
**Post date:** [July 24, 2004, 10:14pm UTC](https://forum.kirupa.com/t/combobox-q/116833/6 "2004-07-24T22:14:08Z")

</div>

Noone knows how to do it? Read that in MX2004 you could use On change, but it doesnt work in MX, so anyone know?

---

<div class="post-metadata">

**Author:** ![2nd\_day](https://avatars.discourse-cdn.com/v4/letter/2/a4c791/32.png) [@2nd\_day](https://forum.kirupa.com/u/2nd_day)\
**Post date:** [July 24, 2004, 10:46pm UTC](https://forum.kirupa.com/t/combobox-q/116833/7 "2004-07-24T22:46:11Z")

</div>

yes it is possible! here is the code you need for the frame where the combobox is positioned:

```auto

function handler () {
	chosen = box.getSelectedItem().label;
	if(chosen == "theoptionfromthecombobox"){
		container.loadMovie("sound.swf");
	}
}

```

the instancename of the combobox has to be box. and has to have the label theoptionfromthecombobox. if you don’t get it… just post a message. for Change Handler you have to fill in handler by Parameters. because handler is the name of the function. if you don’t get it… just post a message.

---

<div class="post-metadata">

**Author:** ![fatnslow](https://avatars.discourse-cdn.com/v4/letter/f/7993a0/32.png) [@fatnslow](https://forum.kirupa.com/u/fatnslow)\
**Post date:** [July 24, 2004, 11:45pm UTC](https://forum.kirupa.com/t/combobox-q/116833/8 "2004-07-24T23:45:23Z")

</div>

Hmm, didnt get it 🙂

Do I have to have one of those AS for each swf i want to load? Since “theoptionfromthecombobox” is just one label…

---

<div class="post-metadata">

**Author:** ![fatnslow](https://avatars.discourse-cdn.com/v4/letter/f/7993a0/32.png) [@fatnslow](https://forum.kirupa.com/u/fatnslow)\
**Post date:** [July 25, 2004, 12:08am UTC](https://forum.kirupa.com/t/combobox-q/116833/9 "2004-07-25T00:08:03Z")

</div>

I have tried alittle now, but can’t get how it works, could you post how you do it, or make an small fla with just the combobox?

With more than one label.

Thanks,  
fatnslow

---

<div class="post-metadata">

**Author:** ![2nd\_day](https://avatars.discourse-cdn.com/v4/letter/2/a4c791/32.png) [@2nd\_day](https://forum.kirupa.com/u/2nd_day)\
**Post date:** [July 25, 2004, 11:08am UTC](https://forum.kirupa.com/t/combobox-q/116833/10 "2004-07-25T11:08:56Z")

</div>

i’m going away now for about 6 hours, when i get back i’ll make that fla 😃

---

<div class="post-metadata">

**Author:** ![fatnslow](https://avatars.discourse-cdn.com/v4/letter/f/7993a0/32.png) [@fatnslow](https://forum.kirupa.com/u/fatnslow)\
**Post date:** [July 25, 2004, 11:11am UTC](https://forum.kirupa.com/t/combobox-q/116833/11 "2004-07-25T11:11:03Z")

</div>

Ok

---

<div class="post-metadata">

**Author:** ![2nd\_day](https://avatars.discourse-cdn.com/v4/letter/2/a4c791/32.png) [@2nd\_day](https://forum.kirupa.com/u/2nd_day)\
**Post date:** [July 25, 2004, 5:17pm UTC](https://forum.kirupa.com/t/combobox-q/116833/12 "2004-07-25T17:17:20Z")

</div>

well here it is then! go to [http://thomas.zeal-music.com/flash](http://thomas.zeal-music.com/flash) and then “save-target-as” combo.fla. have fun!

---

<div class="post-metadata">

**Author:** ![fatnslow](https://avatars.discourse-cdn.com/v4/letter/f/7993a0/32.png) [@fatnslow](https://forum.kirupa.com/u/fatnslow)\
**Post date:** [July 25, 2004, 10:27pm UTC](https://forum.kirupa.com/t/combobox-q/116833/13 "2004-07-25T22:27:00Z")

</div>

Thanks, but how do I get it to load another .swf on label 2? I have tried copying it so I have to codes and then change label to sound2:

```auto
 
function handler () {
 // this function will be called when you choose an item
 chosen = combobox.getSelectedItem().label;
 // difine var chosen
 // chosen is the label you selected from ComboBox "combobox"
 // a label you can define at the parameters tab at the properties of a ComboBox
 if(chosen == "sound1"){
  // if item/label soudn1 is selected then
  container.loadMovie("sound.swf");
  // load movie sound.swf into mc container
 }
}
function handler () {
 // this function will be called when you choose an item
 chosen = combobox.getSelectedItem().label;
 // difine var chosen
 // chosen is the label you selected from ComboBox "combobox"
 // a label you can define at the parameters tab at the properties of a ComboBox
 if(chosen == "sound2"){
  // if item/label soudn1 is selected then
  container.loadMovie("sound2.swf");
  // load movie sound.swf into mc container
 }
}

```

But it only loads one of them, so how can I get it to load another .swf on another label?

Appreciate all help,  
fatnslow

---

<div class="post-metadata">

**Author:** ![fatnslow](https://avatars.discourse-cdn.com/v4/letter/f/7993a0/32.png) [@fatnslow](https://forum.kirupa.com/u/fatnslow)\
**Post date:** [July 25, 2004, 10:44pm UTC](https://forum.kirupa.com/t/combobox-q/116833/14 "2004-07-25T22:44:30Z")

</div>

Nm, I found it out, just used else if. Probably some easier way, but this works for me atleast 🙂

```auto
 
function handler() {
	chosen = combobox.getSelectedItem().label;
	if (chosen == "sound1") {
		container.loadMovie("sound.swf");
	} else if (chosen == "sound2") {
		container.loadMovie("sound2.swf");
	} else if (chosen == "sound3") {
		container.loadMovie("sound3.swf");
	}
}

```

---

<div class="post-metadata">

**Author:** ![fatnslow](https://avatars.discourse-cdn.com/v4/letter/f/7993a0/32.png) [@fatnslow](https://forum.kirupa.com/u/fatnslow)\
**Post date:** [July 25, 2004, 11:43pm UTC](https://forum.kirupa.com/t/combobox-q/116833/15 "2004-07-25T23:43:32Z")

</div>

But, someone shouldn’t happen to know how to set the text color to black in the dropdown part, and after selected and item?? Because I have made the highlight area white (alpha 0%) and then you cant see the white text.

---

<div class="post-metadata">

**Author:** ![2nd\_day](https://avatars.discourse-cdn.com/v4/letter/2/a4c791/32.png) [@2nd\_day](https://forum.kirupa.com/u/2nd_day)\
**Post date:** [July 26, 2004, 7:49pm UTC](https://forum.kirupa.com/t/combobox-q/116833/16 "2004-07-26T19:49:23Z")

</div>

what do you mean? the text only has to be black when dropping down or after selected it? or does it has to be black all the time?

---

<div class="post-metadata">

**Author:** ![fatnslow](https://avatars.discourse-cdn.com/v4/letter/f/7993a0/32.png) [@fatnslow](https://forum.kirupa.com/u/fatnslow)\
**Post date:** [July 26, 2004, 7:56pm UTC](https://forum.kirupa.com/t/combobox-q/116833/17 "2004-07-26T19:56:36Z")

</div>

Black all the time, when dropped down, when selected etc…

---

<div class="post-metadata">

**Author:** ![2nd\_day](https://avatars.discourse-cdn.com/v4/letter/2/a4c791/32.png) [@2nd\_day](https://forum.kirupa.com/u/2nd_day)\
**Post date:** [July 26, 2004, 8:17pm UTC](https://forum.kirupa.com/t/combobox-q/116833/18 "2004-07-26T20:17:36Z")

</div>

have you searched the kirupaforums already 😉 [http://www.kirupaforum.com/forums/showthread.php?t=64076&highlight=combobox](http://www.kirupaforum.com/forums/showthread.php?t=64076&highlight=combobox)

---

<div class="post-metadata">

**Author:** ![fatnslow](https://avatars.discourse-cdn.com/v4/letter/f/7993a0/32.png) [@fatnslow](https://forum.kirupa.com/u/fatnslow)\
**Post date:** [July 26, 2004, 8:28pm UTC](https://forum.kirupa.com/t/combobox-q/116833/19 "2004-07-26T20:28:47Z")

</div>

I have tried using style stuff, but the text still gets white after I have selected it, I dont want the gray highlight, so I made it alpha 0, but the text is still white after using style stuff

---

<div class="post-metadata">

**Author:** ![2nd\_day](https://avatars.discourse-cdn.com/v4/letter/2/a4c791/32.png) [@2nd\_day](https://forum.kirupa.com/u/2nd_day)\
**Post date:** [July 26, 2004, 8:43pm UTC](https://forum.kirupa.com/t/combobox-q/116833/20 "2004-07-26T20:43:38Z")

</div>

then you haven’t tried good enough 😉

```auto

formStyleFormat = new FStyleFormat();
formStyleFormat.textColor = "0x000000";
formStyleFormat.textSelected = "0x000000";
formStyleFormat.textFont = "Arial";
formStyleFormat.addListener(comboBox);

```

.textSelected is form the text you selected en when its dropped down
