解决方法
默认情况下,您无法执行此操作.但是,如果扩展ComboBox,则可以轻松添加此功能.这是一个简单的例子,它是一个粗略的版本,可能需要测试/调整,但它显示了如何实现这一目标.
package { import mx.controls.ComboBox; import mx.core.UIComponent; public class ComboBox2 extends ComboBox { public function ComboBox2() { super(); } protected var textInputReplacement:UIComponent; override protected function createChildren():void { super.createChildren(); if ( !textInputReplacement ) { if ( itemRenderer != null ) { //remove the default textInput removeChild(textInput); //create a new itemRenderer to use in place of the text input textInputReplacement = itemRenderer.newInstance(); addChild(textInputReplacement); } } } override protected function updateDisplayList(unscaledWidth:Number,unscaledHeight:Number):void { super.updateDisplayList(unscaledWidth,unscaledHeight); if ( textInputReplacement ) { textInputReplacement.width = unscaledWidth; textInputReplacement.height = unscaledHeight; } } } }