all groups > flash actionscript > june 2004 >
You're in the

flash actionscript

group:

combo box component help



combo box component help simonfroude
6/27/2004 8:24:23 PM
flash actionscript: how do i tell which option of a combo box the user has selected, then perform
an action if it is a certain option?

at the moment i am using the code...

if (_root.timezoneapp.timezone.getSelectedIndex.data==option3) {
_root.feedback4 = "Correct";
_root.score++; }
else { _root.feedback4 = "Correct TimeZone not selected"; }

timezoneapp = the name of the movie clip its in
timezone = the name of the combo box

As for the rest its what was suggested to me to use. I want the third option
in the combo box list to perform the action. At the moment that code seems to
be always returning a "Correct" result, even if i dont select anything at all
???

any help pls...
Re: combo box component help Jack.
6/27/2004 8:44:13 PM
try -
if (_root.timezoneapp.timezone.getSelectedIndex().data=="option3")

Re: combo box component help simonfroude
6/29/2004 10:10:49 PM
thanks for the reply.

ive tried the code you suggested but it doesnt seem to be working. if i
select the third option in combo box then it still says incorrect :(

any other suggestion ? ive been stuck on this for days now :(
Re: combo box component help Jack
6/30/2004 8:53:35 PM

[quoted text, click to view]

i use MX6, where a changeHandler function deals with combobox
selections, this has changed with MX04 so check the 04 Help Files
if using that version. MX6 code would be -

timezone.setChangeHandler("handle");
function handle(comp){
var dat = comp.getSelectedItem().data;
trace(dat);
if(dat=="option3"){trace("error3");}
};

hth

AddThis Social Bookmark Button