简体   繁体   中英

ComboBox Text Formatting through AS3

I am developing an AIR application and I need to change the font size of the text that is displayed in the dropDown List as well as the main text on the comboBox. My ComboBox is quite big in size but the text displayed in it is very small. I tried using the setStyle method by passing a TextFormat into it like :

cmbEmployee.setStyle("textFormat", txtform);

but it didn't work. Although the same method works well with a TextField.

Can somebody help ?

A ComboBox is a container that contains a textField and a dropdown component. You need to apply the "styles" to the specific components inside of the ComboBox:

// Text Formats that needs to be applied on your comboBox
var txtformat:TextFormat = new TextFormat(); 
    txtformat.size = 30;   // Lets just increase the size of fonts   

// Increase the main TextField's font size of your ComboBox
yourComboBox.textField.setStyle("textFormat", txtformat);

// Increase the font size to the dropdown component
yourComboBox.dropdown.setRendererStyle("textFormat", txtformat);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM