|
|
|||||
[+1 05.11.12]
Регистрация: Feb 2011
Сообщений: 431
|
Проблема с FontStyle.ITALIC
Доброго времени суток.
Пытаюсь в spark TextArea поменять шрифт на Italic, если он уже Italic, меняю на Regular. private function setItalic():void { var styleObj:TextLayoutFormat = new TextLayoutFormat(); var curFormat:TextLayoutFormat = new TextLayoutFormat(); //формат выделенного куска текста curFormat = mainTF.getFormatOfRange(); var i:int = Math.abs(mainTF.selectionActivePosition - mainTF.selectionAnchorPosition); //сколько текста выделили if (i == 0) // если не выделяли текст то задаём всему ITALIC if(mainTF.textFlow.fontStyle == FontStyle.ITALIC) mainTF.textFlow.fontStyle = FontStyle.REGULAR; else mainTF.textFlow.fontStyle = FontStyle.ITALIC; else { if (curFormat.fontStyle == FontStyle.ITALIC) { //если уже италик то меняем на REGULAR curFormat.fontStyle = "regular"; //и вот тут ошибка mainTF.setFormatOfRange(curFormat); } else { styleObj.fontStyle = FontStyle.ITALIC; mainTF.setFormatOfRange(styleObj); } } } При первом нажатии (с выделением текста или без), всё нормально - задаёт тексту Italic, при повторном нажатии - выдаёт RangeError: Property fontStyle value regular is out of range at flashx.textLayout.property::Property$/defaultErrorHandler()[C:\Vellum\branches\v2\2.0\dev\output\openSource\textLayout\src\flashx\textLayout\property\Property.as:31] at flashx.textLayout.property::Property/setHelper()[C:\Vellum\branches\v2\2.0\dev\output\openSource\textLayout\src\flashx\textLayout\property\Property.as:230] at flashx.textLayout.formats::TextLayoutFormat/setStyleByProperty()[C:\Vellum\branches\v2\2.0\dev\output\openSource\textLayout\src\flashx\textLayout\formats\TextLayoutFormat.as:628] at flashx.textLayout.formats::TextLayoutFormat/set fontStyle()[C:\Vellum\branches\v2\2.0\dev\output\openSource\textLayout\src\flashx\textLayout\formats\TextLayoutFormat.as:1363] at flashx.textLayout.elements::FlowElement/set fontStyle()[C:\Vellum\branches\v2\2.0\dev\output\openSource\textLayout\src\flashx\textLayout\formats\TextLayoutFormatInc.as:571] at components::TextTool/setItalic()[E:\work_work\test\src\components\TextTool.mxml:63] at components::TextTool/__italicButton_click()[E:\work_work\test\src\components\TextTool.mxml:131] |
|
|||||
Нуб нубам
модератор форума
Регистрация: Jan 2006
Адрес: Бердск, НСО
Сообщений: 6,445
|
Хелп:TextLayoutFormat#fontStyle
Цитата:
__________________
Reality.getBounds(this); Последний раз редактировалось Wolsh; 09.10.2012 в 21:33. |
Часовой пояс GMT +4, время: 17:33. |
|
« Предыдущая тема | Следующая тема » |
|
|