【问题标题】:actionscript transparent textinput backgroundactionscript 透明 textinput 背景
【发布时间】: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;

【问题讨论】:

    标签: actionscript-3 background transparent textinput


    【解决方案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);
    

    【讨论】:

    • 你确定:) 背景是文本字段的一部分吗?而不是下面的形状/精灵?
    猜你喜欢
    • 2011-03-08
    • 2015-12-12
    • 2021-09-20
    • 2019-02-07
    • 2020-10-15
    • 2017-06-22
    • 2010-10-20
    • 2011-02-01
    • 2013-12-10
    相关资源
    最近更新 更多