![]() |
|
||||||||||
|
|||||||
|
|
« Предыдущая тема | Следующая тема » |
| Опции темы | Опции просмотра |
|
![]() |
![]() |
|
|
|
|||||
|
Регистрация: Nov 2005
Сообщений: 1,058
|
В справке сказано цитирую:
Цитата:
|
|
|||||
|
Et cetera
Регистрация: Sep 2002
Сообщений: 30,787
|
using style sheets
|
|
|||||
|
Регистрация: Nov 2005
Сообщений: 1,058
|
Это я понял. Реквестирую пример стиля.
|
|
|||||
|
Et cetera
Регистрация: Sep 2002
Сообщений: 30,787
|
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="this.init();">
<mx:Label id="testLabel">
</mx:Label>
<mx:Script>
<![CDATA[
import mx.core.mx_internal;
use namespace mx_internal;
private function init():void {
var styleSheet:StyleSheet = new StyleSheet();
styleSheet.setStyle("a:link", { textDecoration: "none", color: "#813F98" });
styleSheet.setStyle("a:hover", { textDecoration: "underline" });
styleSheet.setStyle("a:active", { textDecoration: "underline" });
this.testLabel.htmlText = '<a href="http://ya.ru">ya.ru</a>';
this.testLabel.mx_internal::styleSheet = styleSheet;
}
]]>
</mx:Script>
</mx:Application>
|
|
|||||
|
Регистрация: Nov 2005
Сообщений: 1,058
|
Спасибо за костыли. Финально это выглядит так
private function createAdvicesStyle():void {
adviceStyle.setStyle("a:link", { textDecoration: "none", color: "#D0EB55" });
adviceStyle.setStyle("a:hover", { textDecoration: "underline" });
adviceStyle.setStyle("a:active", { textDecoration: "underline" });
}
<mx:Repeater id="advicesRPTR" dataProvider="{_advices}">
<mx:Canvas label="{'- ' + advicesRPTR.currentItem.title}" width="100%" height="100%"
backgroundColor="#6F7777" fontWeight="normal">
<mx:Text width="100%" height="100%" selectable="true"
creationComplete="{event.target.styleSheet = adviceStyle}">
<mx:htmlText>
{' ' + advicesRPTR.currentItem.body}
</mx:htmlText>
</mx:Text>
</mx:Canvas>
</mx:Repeater>
Последний раз редактировалось †‡Paladin‡†; 29.04.2008 в 16:59. |
|
|||||
|
Регистрация: Jul 2005
Сообщений: 135
|
А что делать, если мне необходимо динамически менять fontSize?
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" applicationComplete="init()"
click="onChangeFontSize()">
<mx:Script>
<![CDATA[
import mx.core.mx_internal;
use namespace mx_internal;
private function init():void {
var css:StyleSheet = new StyleSheet();
css.setStyle("a:link", {color:"#0000CC"});
txt.mx_internal::styleSheet = css;
}
private function onChangeFontSize():void {
var size:Number = box.getStyle("fontSize") + 1;
box.setStyle("fontSize", size);
}
]]>
</mx:Script>
<mx:Box id="box" width="100%" height="100%">
<mx:Text id="txt">
<mx:htmlText>
<![CDATA[qwe <a href="http://ya.ru">ya.ru</a> qwe]]>
</mx:htmlText>
</mx:Text>
</mx:Box>
</mx:Application>
ps можно конечно обрамлять текст с помощью но хочется, чтоб все было автоматически как с обычным текстом без css |
![]() |
![]() |
Часовой пояс GMT +4, время: 07:31. |
|
|
« Предыдущая тема | Следующая тема » |
| Опции темы | |
| Опции просмотра | |
|
|