all groups > flash actionscript > october 2006 >
You're in the

flash actionscript

group:

ComboBox assistance


Re: ComboBox assistance dan mode ->Adobe Community Expert
10/26/2006 4:08:26 PM
flash actionscript: Brenton07,

Here's a little snippet for you that might help you on your way:

//get some data into the comboBox
mycomboBox.addItem({label:"item1",data:"item1"})
mycomboBox.addItem({label:"item2",data:"item2"})
mycomboBox.addItem({label:"item3",data:"item3"})

//listener to add the label & data of the selected item in the comboBox to
the listBox
var listenerObject:Object = new Object();
listenerObject.change = function(eventObject:Object) {
mylistBox.addItem({label:mycomboBox.selectedItem.label,data:mycomboBox.selectedItem.label})
};
mycomboBox.addEventListener("change", listenerObject)


hth

--

Dan Mode
--> Adobe Community Expert
*Flash Helps* http://www.smithmediafusion.com/blog/?cat=11
*THE online Radio* http://www.tornadostream.com
*Must Read* http://www.smithmediafusion.com/blog


[quoted text, click to view]

ComboBox assistance Brenton07
10/26/2006 9:13:05 PM
I am working on a flash file that will allow an admin to upload and customize
database entries without going into MYSQL. Part of that is designating
categories. I want a simple set where the user selects something from
mycombobox, and depending on which one they choose, it populates another
combobox with different options. I have been trying just moving from combobox
to listbox to make things simpler, but I've tried it both ways, and the code
doesn't work, and I don't see why. I based this off an old tutorial, perhaps
it's coded wrong? I am working in Flash 8, AS 2.0. .... HELP!!??

onSelect = function () {
text = mycombobox.getValue()
}

onChanged = function () {

if (mycomboBox.getValue() == "null") {
mylistBox.removeAll();
mylistBox.addItem("Please Select One");
}


if (mycomboBox.getValue() == "Movies") {

mylistBox.removeAll();
mylistBox.addItem("Comedy", "com");
mylistBox.addItem("Drama", "dra");
mylistBox.addItem("Mystery", "myst");
mylistBox.addItem("Adventure", "adv");
mylistBox.addItem("Sci-Fi", "scifi");
mylistBox.addItem("Western", "west");
mylistBox.addItem("War", "war");
}
AddThis Social Bookmark Button