Hi everybody,
I’m trying to autosize my combobox, according to the textWidth of its biggest items. I’ve got the right textWidth without setting the textFormat, but by setting textFormat, with a bigger font size (like 30), the textWidth stays the same !
var myFormat : TextFormat = new TextFormat("Trebuchet MS", 30, 0x0000FF);var myCbx
myCbx= new ComboBox ;
myCbx.x = 0;
myCbx.y = 0;
myCbx.textField.setStyle("textFormat",myFormat);
myCbx.textField.setStyle("embedFonts",true);
myCbx.dropdown.setRendererStyle("textFormat",myFormat);
myCbx.dropdown.setStyle("embedFonts",true);
myCbx.addItem({label:"one"});
myCbx.addItem({label:"one more"});
this.addChild(myCbx);
for (var m:uint = 0 ; m < myCbx.length ; m++) {
myCbx.selectedIndex = m;
myCbx.drawNow();
trace(myCbx.textField.textWidth); // here is my trace, unchanged whatever the font size applied to my comboxbox
}
Any idea ?
Thanks