View Full Version : Combobox Variable Question
Cheska
05-29-2006, 02:30 PM
Hi,
I am using Flash MX 2004 on a mac platform.
How do I get myCrazyVariable to be equal to the data of my CrazyCombobox user selection?
myCrazyVariable = ????
Thanks for any help offered :)
Cheska
(also - how do i say if its a string or other typ eof variabel etc?)
anticonnor
05-30-2006, 12:58 AM
There have been many posts on this topic. Try this:
var myCrazyVariable:String;
myCrazyVariable = this.crazyCombobox.getSelectedItem().data;
Cheska
05-30-2006, 01:11 AM
Hi anticonnor,
thansk for your reply ...but i dont see any message/code....
Well, i figured it out to be :
myVariable = myCombo.getValue();
but im interested to see what you ahd also, incase there are other ways...
thanks@
cheska
anticonnor
05-30-2006, 07:34 AM
I pulled that code from a submit button that I had in a large form with a combobox, so it only defines the variable after the user made their selection and was done with the form.
You might be trying to update your dynamic text field immediately upon any change to the combobox, in which case you'll need to add an event listener:
var cbListener:Object = new Object();
cbListener.change = function(event_obj:Object) {
myVariable = event_obj.target.selectedItem.label;
};
myCombo.addEventListener("change", cbListener);
You can find more help on this in the Flash help files.
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.