【问题标题】:To add color for textInput in Flash?在 Flash 中为 textInput 添加颜色?
【发布时间】:2011-12-01 07:17:00
【问题描述】:

我在将 backgroundColor 应用到 Flash 中的 TextInput 组件时遇到问题。我有一个名为 LastLayer 的 MoveClip;在该层中,我使用组件设计了 TextInput。现在我想为 TexInput 添加背景颜色。谁指导我。如何添加背景颜色?提前致谢!

txtUser 是我的 TextInput 组件的实例名称。我试过这段代码,但它不起作用:

txtUser.setStyle("backgroundColor", "#000000"));

【问题讨论】:

    标签: flash components textinput


    【解决方案1】:

    试试这个:

    var tf:TextFormat = new TextFormat();
    tf.size = 25;
    tf.color = 0xFF0000;
    var ti:TextInput = new TextInput();
    ti.textField.background=true;
    ti.textField.backgroundColor = 0xffcc00;
    ti.x = 100;
    ti.y = 100;
    ti.width = 200;
    ti.height = 30;
    ti.text = "your text here";
    ti.setStyle("textFormat", tf);
    addChild(ti);
    

    【讨论】:

    • 好的,我在很多地方更改了文本,如果我喜欢这个,我无法显示文本。因为我只添加了一次孩子。
    • 我使用组件设计了TextInput,我的Text Input id 是txtUser。我试过这个 code.txtUser.setStyle("backgroundColor", "#000000"));
    • txtUser.textField.background=true; txtUser.textField.backgroundColor = 0x000000;
    猜你喜欢
    • 1970-01-01
    • 2014-02-14
    • 1970-01-01
    • 2020-03-27
    • 2021-08-03
    • 2010-12-01
    • 2012-12-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多