开发者

Flex combobox needs to be selected twice to open drop down list

When a combobox is elected i开发者_如何转开发n the flex app, there is a quick flicker, then the combobox needs to be selected again in order to get the dropdown to open. After that, the dropdown works as expected, but only while selecting the control subsequent times while on the form. Reloading the form requires the double selection again. Any insights to how to clear this up would be very much appreciated.


The way I had to get around this issue was my creating a custom component that extends the ComboBox control that will set the ComboBox's List dataProvider at the same time as the ComboBox's dataProvider.

ComboBoxFix.as

package
{
    import mx.controls.ComboBox;

    public class ComboBoxFix extends ComboBox
    {
        public function ComboBoxFix()
        {
            super();
        }

        override public function set dataProvider(value:Object):void 
        {
            super.dataProvider=value;

            if(dropdown != null)
            {
                super.dropdown.dataProvider=value;
            }
        }

        override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number ):void 
        {
            super.updateDisplayList (unscaledWidth, unscaledHeight);
            if (dropdown != null)
            {   
                dropdown.width = unscaledWidth; 
            }
        }
    }
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜