2 Replies Latest reply on Apr 12, 2007 7:52 AM by kglad

    How to add in combobox itens in varied colors?

    flashcomp
      Hi

      I want that combobox has itens in varied colors. If I use - > combo.setStyle (“color”, “0x000FFF”); itens is all of the same color. I need that an item is blue, another red, another yellow therefore each item I go to mean a thing different as the color. How to add in combobox itens in varied colors?

      Thanks
        • 1. Re: How to add in combobox itens in varied colors?
          flashcomp Level 1
          I tested itemRollOver event and it functioned.It follows below.

          my_cb.addItem({data:0, label:"0 Item"});
          my_cb.addItem({data:1, label:"1 Item"});
          my_cb.addItem({data:2, label:"2 Item"});
          my_cb.addItem({data:3, label:"3 Item"});
          _global.libera_RollOver = 1;
          var cbListener:Object = new Object();
          cbListener.open = function(evt_obj:Object) {
          my_cb.selectedIndex = null;
          libera_RollOver = 1;
          };
          cbListener.itemRollOver = function(evt_obj:Object) {
          //trace("index: "+evt_obj.index+", event: "+evt_obj.type);
          if (libera_RollOver == 1) {
          if (evt_obj.index == 1 or evt_obj.index == 3) {
          my_cb.selectedIndex = evt_obj.index;
          my_cb.setStyle("themeColor", "0x66ccff");
          } else {
          my_cb.selectedIndex = evt_obj.index;
          my_cb.setStyle("themeColor", "0xFF6666");
          }
          } else {
          break;
          }
          };
          cbListener.change = function(evt_obj:Object) {
          libera_RollOver = 0;
          };
          my_cb.addEventListener("open", cbListener);
          my_cb.addEventListener("itemRollOver", cbListener);
          my_cb.addEventListener("change", cbListener);
          • 2. Re: How to add in combobox itens in varied colors?
            kglad Adobe Community Professional & MVP
            use "alternatingRowColors" in your style properties:

            my_cb.setStyle("alternatingRowColors", [0xff0000,0x00ff00,0x0000ff,0xffff00,0xff00ff]);