actionscript 透明 textinput 背景

Posted

技术标签:

【中文标题】actionscript 透明 textinput 背景【英文标题】:actionscript transparent textinput background 【发布时间】:2012-11-07 09:08:13 【问题描述】:

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

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

nameField.alpha = 0;

【问题讨论】:

【参考方案1】:

TextInput 有 contentBackgroundAlphacontentBackgroundColor 样式。

nameField.setStyle("contentBackgroundAlpha", 0);

附:如果你使用 FLEX。

【讨论】:

我不知道 Flex 是什么 :( 好吧,我刚刚用谷歌搜索了它。它是 AS3 程序员的某种“必备”吗?我应该下载它吗? 不是必须的——它是在 AS、FLash IDE、Flex 和纯 ActionScript 中使用 3rd 方编辑器和 Flex SDK 进行编程的另一种方式。【参考方案2】:

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);

【讨论】:

你确定:) 背景是文本字段的一部分吗?而不是下面的形状/精灵?

以上是关于actionscript 透明 textinput 背景的主要内容,如果未能解决你的问题,请参考以下文章

在 ActionScript3 中,我无法在 TextInput 中查看长文本

ActionScript 3 AS3:使用新的TextFormat()向TextInput组件添加样式

如何在 React Native 中创建一个半透明的 <TextInput/>?

如何取消 Halo/Spark TextInput 和 TextArea 组件中的编辑

如何在 Flex actionscript 中确认文本输入

RN-TextInput组件去掉下划线