开发者

How to always force show ColorPicker's dropdown color list?

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 withou开发者_如何学运维t any interaction from the user?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜