2014-11-21 4 views
1

Adobe Flash에서 IOS 앱을 사용 중입니다. 텍스트 필드의 색상을 변경하려고합니다. 나는 텍스트 색상Adobe Flash AS3 텍스트 필드 변경 색상

myTextP1.setTextFormat(format,0,24); 

변경이 완벽 또한 25 문자까지 FORST 뜯거나 변경 텍스트의 색상을 작동하는 방법을 가지고 ...하지만 내 문제는 내가 첨부 된 텍스트의 색상을 변경해야합니다. 예를 들어 내 텍스트는 "나는 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;