tags:

views:

36

answers:

1

I have a combobox which gets populated by a remote method. I need to set the dropdownwidth of the combobox to the maximum length of the item in the combobox. I am able to achieve it by the following code. But if the resolution of the screen changes, the result is not similar. Is there any way to find the display width of the text in the dropdown?

private function getGroupData(resultEvent:ResultEvent):void{
            viewCbx.dataProvider = resultEvent.result as ArrayCollection;
            var comboDp:ArrayCollection = viewCbx.dataProvider as ArrayCollection;
            var dropWidth:int = 0;
            for each(var obj:Object in comboDp){
                if(obj.groupName.length > dropWidth){
                    dropWidth = obj.groupName.length;
                }
            }

            viewCbx.dropdownWidth = dropWidth*6;

        }
A: 

This may be able to solve your issue

http://ifeedme.com/blog/?p=19

invertedSpear