0

我希望 ColorPicker 弹出式样本始终保持打开状态。

var cp:ColorPicker = new ColorPicker();
cp.open(); 

工作正常,但是当焦点丢失时,窗口会关闭。有什么建议么?谢谢

Flash默认颜色选择器

4

1 回答 1

1

取决于您使用的颜色选择器。(我的意思是谁写的)。

但这一个可以根据您的需要工作: http: //www.bit-101.com/blog/ ?p=2347

更新

然后你需要创建你自己的 ColorPicker 类来扩展原来的 ColorPicker:

package  
{
    import fl.controls.ColorPicker;
    import flash.events.MouseEvent;
    /**
    * ...
    * @author Jevgenij Dmitrijev ( http://www.ifmi.lt )
    *
    * @created {2012.05.10 16:08}
    *
    */
    public class CustomColorPicker extends ColorPicker
    {
        var _allowHide:Boolean = false;

        public function CustomColorPicker() 
        {

        }

        override protected function onStageClick(event:MouseEvent):void 
        {
            //Simple example .
            if(_allowHide)
                super.onStageClick(event);
        }

        override protected function onSwatchClick(event:MouseEvent):void 
        {
            // since on click it is closing, ovveride the function
            // and super the over function, since it is the one
            // which changes the color.
            super.onSwatchOver(event)
        }

        override protected function onSwatchOver(event:MouseEvent):void 
        {
            // just ovveride it, so it would do nothing.
        }
    }
}

然后在你的项目中使用:

var colorPickerMC:CustomColorPicker = new CustomColorPicker ();
addChild(colorPickerMC);
于 2012-05-10T08:05:48.660 回答