Skip to main content
November 14, 2009
Question

How to use a comboBox to select a "colour palette"

  • November 14, 2009
  • 1 reply
  • 201 views

I want to use a comboBox from which the user selects a colour theme.  When the item is selected, I want it to run a function that will then change various item's attributes.  I don't know where to store the new attribute values though.  I tried storing them in comboBox item under DATA but that didn't work.  I also tried having a function as data which didn't work either.  Any suggestions?

This topic has been closed for replies.

1 reply

November 14, 2009

Only way I can think of is using an IF statement

ie

paletteCombo=new ComboBox();

               paletteCombo.addItem({data:aqua,label:"aqua"});

               paletteCombo.addItem({data:rose,label:"rose"});

               paletteCombo.move(400,157);

               addChild(paletteCombo);

               paletteCombo.addEventListener(Event.CHANGE, comboHandler);

function comboHandler(e:Event){

var myData:TextFormat = event.currentTarget.selectedItem.data;

if (myData=="rose"){

          various formatting occurs

     }

}