2014-11-21 92 views
1

我正在Adobe Flash中运行IOS应用程序...我正在尝试更改文本字段的颜色。我的方法改变文字颜色Adob​​e FLASH AS3文本字段更改颜色

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."); 
    } 

} 

回答

0

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

myTextP1.defaultTextFormat = format;

反过来,你也可以只通过TextFieldtextColor属性设置:

myTextP1.textColor = 0xFF0000;