views:

110

answers:

1

To show the complete list of available colors, one has to click the color box of ColorPicker control.

How can the component be modified to forcefully always shown the colors list without any interaction from the user?

+2  A: 

You can call the open method (which calls an mx_internal method displayDropdown):

<?xml version="1.0" encoding="utf-8"?>
<mx:Application
 xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

 <mx:Script>
  import mx.events.DropdownEvent;

  protected function initializeInterruption():void
  {
   color.addEventListener(DropdownEvent.CLOSE, interrupt);
  }

  protected function interrupt(event:Event):void
  {
   color.open();
  }
    </mx:Script>

 <mx:ColorPicker id="color" closeDuration="0" openDuration="0"
  initialize="initializeInterruption()"
  creationComplete="color.open()"/>

</mx:Application> 

You also have the option of extending the ColorPicker class and overriding some/all of these methods:

  • keyDownHandler
  • downArrowButton_buttonDownHandler
  • open
  • close

Let me know if that works, Lance

viatropos
This worked just the way I wanted, thanks!
Yeti