Change color of text in ActionScript3 after exact character -


i want know if possible change font color in dynamic text field after exact character, example want text after : blue.

you can count in string exact character , use length of splited string on character:

var my_str:string = "this text black: , text white"; var my_array:array = my_str.split(":");  var testtext:textfield  = new textfield(); testtext.text = my_str; addchild(testtext);  var format1:textformat = testtext.gettextformat(0, my_array[0].length); format1.color = 0x000000; testtext.settextformat(format1, 0, my_array[0].length);   var format2:textformat = testtext.gettextformat(my_array[0].length+1, testtext.length); format2.color = 0xffffff; testtext.settextformat(format2, my_array[0].length+1, testtext.length); 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -