Get the ComboBox control to work in AS3

Hi all

Am very new to AS and try to get a comboBox control to work. I copied and pasted the following on the Adobe site in frame 1:

Add items to the list.
my_cb. AddItem ({data: 1, label: "An object"});
my_cb. AddItem ({data: 2, label: "the second point"});
my_cb. AddItem ({data: 3, label: "the third point"});
my_cb. AddItem ({data: 4, label: "fourth point"});

var cbListener:Object = new Object();
cbListener.change = {function (evt_obj:Object)}
var item_obj:Object = my_cb.selectedItem;
var i: String;
for {(i in item_obj)
trace (I + ": \t" + item_obj );
}
trace("");
};
my_cb.addEventListener ("change", cbListener);

I have a comboBox control named my_cb onstage. But when I run it, I get this error: "1118: implicit constraint of a static type value Object to a type perhaps unrelated function.»

I can't wait to head, so I try to decipher what you try to do it from code, but here's a revised version that might get you where you're going (?):

Add items to the list.
my_cb. AddItem ({data: 1, label: "An object"});
my_cb. AddItem ({data: 2, label: "the second point"});
my_cb. AddItem ({data: 3, label: "the third point"});
my_cb. AddItem ({data: 4, label: "fourth point"});

function cbListener(evt_obj:Object) {}
var item_obj:Object = my_cb.selectedItem;
var i: String;
for {(i in item_obj)
trace (I + ": \t" + item_obj);
}
trace("");
};
my_cb.addEventListener (Event.CHANGE, cbListener);

Tags: Adobe Animate

Similar Questions

Maybe you are looking for

  • Massive memory leak Safari

    Since the installation of OSX v10.11.5 my Safari has developed a massive leak, making it unusable. I can look in the activity monitor the RAM is typed, then passing slot, making me have to force quit Safari, whenever it is open. Everyone knows this?

  • HP Pavilion g7-1204sa PC notebook bluetooth

    Hi can anyone tell me if the laptop to HP Pavilion g7-1204sa a bluetooth built and if not can it be somehow thank you

  • is it a hoax? Please help asap-received a e-mail from Windows Live

    I got the e-mail from windows live saying that my hotmail account is disabled in the next 24 hours because of several unsuccessful connection attempts, and I need to connect safely through activation here link. I havnt had any problems of connection

  • update to Microsoft Windows Mobile 6.1 on the pocket pc

    I have a HP Ipaq HX2490b with Microsoft Windows Mobile 5.0 build (2003?) 14366.1.0.1. why the new 6.1 is not compatible with versions earlier than 14847 version? It's been almost what I obsolete, and it is only a few years old. Is there a way to get

  • Display the pages Web HTTPS but HTTP Web pages are not

    Hello All of a sudden, http Web pages not loading for me in Explorer, Chrome or Firefox.  One minute, they are involved, but the next minute, they were not. I don't get an error message in the browser.  Rather, the address of the site remains in the