1

经过数小时的搜索,我成功地将字体颜色设置为黄色,但我仍然无法弄清楚如何使 textinput 的背景透明:((我将它拖出组件窗口)我的代码有什么问题?

var tf:TextFormat = new TextFormat();
tf.size = 10;
tf.color = 0xFFF000;
nameField.setStyle("textFormat", tf);

nameField.alpha = 0;
4

2 回答 2

3

TextInput 有样式contentBackgroundAlphacontentBackgroundColor

nameField.setStyle("contentBackgroundAlpha", 0);

PS 如果你使用 FLEX。

于 2012-11-19T13:27:38.343 回答
0

nameField.background = false;你应该检查文档。

如以下示例

var input:TextField = new TextField();
input.textColor = 0xFFFF00;
input.background = false;
input.backgroundColor = 0x000000;//this is to show that the background is not visible - you can put any colour other than SWF's background:)
input.type = TextFieldType.INPUT;

addChild(input);
于 2012-11-19T13:23:01.690 回答