我希望能够使用我的CSS文件中定义的样式设置TextFlow元素的样式。我当前的TextFlow实现如下所示,但我的样式的更改似乎没有生效。如何在Flex 4.5.1中使用CSS样式设置TextFlow的样式?
// In defaults.css
.textHeader
{
fontFamily: "Trebuchet MS";
fontWeight: normal;
fontStyle: normal;
fontSize: 25;
color: #FF0000;
}
.textBody
{
fontFamily: "Trebuchet MS";
fontWeight: normal;
fontStyle: normal;
fontSize: 12;
color: #525252;
}
// In MySkin.mxml
<s:RichText left="5" right="5" top="5" bottom="5" id="richText">
<s:textFlow>
<s:TextFlow>
<s:p styleName="textHeader">
Cupcake cookie cotton candy chupa chups biscuit marzipan.
</s:p>
<s:p styleName="textBody">
Cupcake cookie cotton candy chupa chups biscuit marzipan.
Jelly beans cake jujubes. Powder cotton candy apple pie applicake.
Bear claw powder dessert macaroon.
</s:p>
</s:TextFlow>
</s:textFlow>
</s:RichText>
答案 0 :(得分:1)
我认为你不能这样做。至少不容易。据Adobe称,TLF不支持CSS样式声明:
http://help.adobe.com/en_US/flex/using/WS02f7d8d4857b1677-165a04e1126951a2d98-7ff2.html
但是,您可能会发现第三方实施有效:
https://dev.c-ware.de/confluence/display/PUBLIC/Flex4+Text-Flow+and+CSS-Styles
(我自己没试过)。