开发者

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

开发者 https://www.devze.com 2022-12-20 18:38 出处:网络
To show the complete list of available colors, one has to click the color box of ColorPicker control.

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

精彩评论

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