![]() |
|
||||||||||
|
|||||
|
Guest
Сообщений: n/a
|
Привет всем!
Есть текстовое поле, в которое вводится текст, затем часть текста выделяется мышъю и этой части нужно затать форматирование... Как задается форматирование всему тексту я знаю... А вот как задать только выделенной части? Я думаю нужно поймать начало и конец выделенного текста - только как? ![]() |
|
|||||
|
Негуру
администратор
Регистрация: Jan 2000
Адрес: Кёнигсберг in Moscow
Сообщений: 21,883
Записей в блоге: 7
|
Читай про:
Selection (объект) Selection.addListener Selection.getBeginIndex Selection.getCaretIndex Selection.getEndIndex Selection.getFocus Selection.onSetFocus Selection.removeListener Selection.setFocus Selection.setSelection |
|
|||||
|
Регистрация: Jun 2005
Адрес: spb
Сообщений: 84
|
Офигенный пример из хэлпа к Flash MX Pro 7.2
this.createTextField("output_txt", this.getNextHighestDepth(), 0, 0, 300, 200);
output_txt.multiline = true;
output_txt.wordWrap = true;
output_txt.border = true;
output_txt.type = "input";
output_txt.text = "Enter your text here";
var my_cm:ContextMenu = new ContextMenu();
my_cm.customItems.push(new ContextMenuItem("Uppercase...", doUppercase));
function doUppercase():Void {
var startIndex:Number = Selection.getBeginIndex();
var endIndex:Number = Selection.getEndIndex();
var stringToUppercase:String = output_txt.text.substring(startIndex, endIndex);
output_txt.replaceText(startIndex, endIndex, stringToUppercase.toUpperCase());
}
output_txt.menu = my_cm;
|
![]() |
![]() |
Часовой пояс GMT +4, время: 16:21. |
|
|
« Предыдущая тема | Следующая тема » |
|
|