通过AS3组合框文本格式

问题描述 投票:4回答:1

我正在开发AIR应用程序,我需要更改下拉列表中显示的文本以及comboBox上的主要文本的字体大小。我的ComboBox很大,但是其中显示的文本很小。我尝试通过将TextFormat传递给它来使用setStyle方法,例如:

cmbEmployee.setStyle("textFormat", txtform);

但是没有用。尽管相同的方法对TextField效果很好。

有人可以帮忙吗?

actionscript-3 flash air combobox
1个回答
6
投票

好吧,ComboBox是一个包含TextField和DropDown List的容器。因此,您不能直接将setStyle应用于ComboBox本身,而需要将其应用于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 of dropDownList items
yourComboBox.dropdown.setRendererStyle("textFormat", txtformat);

尝试一下!

© www.soinside.com 2019 - 2024. All rights reserved.