• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 470
  • Last Modified:

Flash AS3 - My combobox will not populate?? Possible bug

hi there. The below code works in one of my other projects, but will not work in my new project!! I do have a combobox working in a movieclip in this project, but even copy and pasting it and the code does not work.

The combox will not populate. It remains empty and you can not drop down the select...

Please help me to find the problem! I have tried for hours now

I drag and drop the combo component and then my code is as below:

import fl.controls.ComboBox;
import fl.data.DataProvider;
var dp:DataProvider = new DataProvider();
dp.addItem({label:"New", data:"NEW"})
dp.addItem( {label:"Copy", data:"COPY"});
combo.dataProvider = dp;
combo.addEventListener(Event.CHANGE, changeHandler);
function changeHandler(event:Event):void {
  var cb:ComboBox = event.currentTarget as ComboBox;
    var item:Object = cb.selectedItem;
	if (cb.selectedIndex ==0) {
		//do something
    } else if(cb.selectedIndex ==1) {
		//do something

Open in new window

1 Solution
This is probably ridiculous, but did you verify that the combo box has the correct instance name in flash?  Is it specified as "combo"?
JarmanjeAuthor Commented:
Thanks for reply

there is no error compiling the code. The combobox seems to be bugged and doesn't populate..
if i copy and paste your code. my combobox gets the labels new and copy.
so if all else fails delete the combobox in the library and stage and drag another instance and try again.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now