Просмотр полной версии : формат в TextField
Как совместить два формата в одном TextField?
Т.е. в строке все слова зеленые, а одно красное подчеркнутое.
так же можно:
у TextField'a есть метод setTextFormat (); один из вариантов использования такой
setTextFormat (startIndex, endIndex, textFormat);
fmt1 = new TextFormat ();
fmt1.color = 0xff0000;
fmt2 = new TextFormat ();
fmt2.color = 0xffffff;
_root.createTextField ("txt", 0, 0, 0, 200, 200);
txt.wordWrap = true;
txt.border = 1;
txt.autoSize = true;
txt.setNewTextFormat (fmt2);
for (var i = 0; i < 200; i++) {
txt.text += i + " ";
}
len = 10;
i = len;
this.onEnterFrame = function () {
i++;
if (i > txt.text.length + len) {
i = len;
}
txt.setTextFormat (i - len * 2, i - len, fmt2);
txt.setNewTextFormat (i - len, i, fmt1);
};
Работает на vBulletin ® версия 3.7.3. Copyright ©2000-2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Copyright © 1999-2008 Flasher.ru. All rights reserved.