【问题标题】:Adobe FLASH AS3 textfield change colorAdobe FLASH AS3 文本字段更改颜色
【发布时间】:2014-11-21 09:59:22
【问题描述】:

我正在使用 Adob​​e Flash 中的 IOS 应用程序...我正在尝试更改文本字段的颜色。我得到了改变文字颜色的方法

myTextP1.setTextFormat(format,0,24);

这也很完美,文本的颜色从第一个字符变为第 25 个字符......但我的问题是我需要更改附加文本的颜色..例如我的文本是“我是 Jocheved”,我我在文本后面加上“Jocheved 是个好人”所以如果我给 0 -3 那么从第一个文本开始颜色正在改变我需要更改附加文本的第一个字符而不是从头开始.. 而不是计算文本直到附加的文本是否有任何其他方法可以更改颜色。

var format:TextFormat = new TextFormat(); 
            format.font = "Verdana"; 
            format.color = 0xFF0000; 
            format.size = 23;

if(my369P==1)
{
    myTextPH1.text = "Strength of Mentality"
    myTextP1.text = "You have a good mind and an excellent memory. You should continue to learn and study throughout your life. You are more intellectual than emotional or practical. You may tend to look down on those who are not your intellectual equals—that could attract bad Karma!"

    if(my258P==1)
    {



        myTextP1.appendText("\n\nStrength of Emotionality")

        myTextP1.setTextFormat(format,0,24);
        myTextP1.appendText("\n\nYou are compassionate, understanding and emotionally balanced. You tend to achieve your goals."); 
    }

}

【问题讨论】:

    标签: actionscript-3 flash append adobe textfield


    【解决方案1】:

    TextField.setTextFormat 仅影响您指定的字符。为了更改所有文本的颜色,您需要设置TextField 的默认文本格式:

    myTextP1.defaultTextFormat = format;

    相反,您也可以通过TextFieldtextColor 属性进行设置:

    myTextP1.textColor = 0xFF0000;

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-07-08
      • 1970-01-01
      • 1970-01-01
      • 2014-08-04
      • 1970-01-01
      • 1970-01-01
      • 2019-11-05
      相关资源
      最近更新 更多