Using the combobox component

hello all,

ok, i have a combobox component with some values: val1, val2

when user clicks a value i want to move the playhead to a frame where the contect will be shown

this would be the pseudo code for it:

===
if val1 gotoAndStop(1);
set the combobox to show val1;

i’ve set up the changeHandler and i’ve added my function to the first keyframe of the movie - it’s just the syntax i’m struggling with

can anybody help me with the actionscript please?

cheers

onChange = function (mycombo){

if(mycombo.getselecteditem().label==val1){
do this or do that;
}

it could be getselecteditem().label or getselecteditem().data for example…

Exactly. And to avoid the ifs, you can use switch/case:

onChange = function (mycombo){
   var myVal=mycombo.getselecteditem().label;
   switch (myVal){
      case val1: //something
           break;
      case val2: //something else
           break;
   }      
}

Just a thought.

pom :slight_smile:

just like old times, Pom. :slight_smile:

Haha!! :stuck_out_tongue:

cheers guys - that works fine!

Much appreciated
:slight_smile:

how do i set the combobox component to show a particular label when i click a button?

i don’t know the methods of the combobox otherwise i’d play about with it until i got it right
:frowning:

Jose, all the methods are in the reference panel and in the actionscript dictionary. It would serve you well to look them up, for you may see system capabilities that you were not aware of, and that we may not mention unless you ask.

i’ve never seen the reference panel before! (i still haven’t fully explored the menu)

i can see all the methods now! (the gets and the sets)
:slight_smile:

thanks Iammontoya!

:slight_smile: