v5_02 Utilizing the Text Layout Framework 使用文本布局框架
?
ex5_02
这部分主要讲
用于控件中的各个属性,及一些关于文本布局框架方面的知识,
包括能够用于格式化文本的流元素
?
Flash Text Engine(flash 文本引擎) FTE是应用于flash player 10中的一个新的类集,它能够支持例如渲染单行文本等较低级的文本功能
?
Text Layout Framework(文本布局框架)或者TLF是一个建立在flash文本引擎顶层的类集
这些类由flex框架提供在两个SWC文件中并被应用程序自动的引用
?
TLF提供了高级的文本格式化功能,包括多行和段落,还有滚动选择和编辑
还有一些类似 于HTML的流元素来格式化文本控件
?
1.在文本控件中使用span br等流元素
<!--WizRtf2Html Charset=0 -->
?
<!--WizRtf2Html Charset=0 -->
<s:RichText textAlign="left" height="222" width="100%" paddingTop="20" lineHeight="20"> <s:span fontWeight="normal"> Water content (grams per 100g) 47.31<s:br/> Calorie content of Food (kcals per 3.5oz) 283<s:br/> Protein content (grams per 100g) 13.25<s:br/> Fat content (lipids) (grams per 100g) 16.18<s:br/> Ash content (grams per 100g) 2<s:br/> Carbohydrate content (grams per 100g) 21.26<s:br/> Dietary Fiber content (grams per 100g) N/A<s:br/> Sugar content (grams per 100g) N/A<s:br/> </s:span> </s:RichText>??
把span调整到每行上
<s:RichText width="100%" lineHeight="20"> <s:span fontStyle="italic">Water content (grams per 100g) 47.31</s:span><s:br/> <s:span fontStyle="italic">Calorie content of Food (kcals per 3.5oz) 283</s:span><s:br/> <s:span fontStyle="italic">Protein content (grams per 100g) 13.25</s:span><s:br/> <s:span fontStyle="italic">Fat content (lipids) (grams per 100g) 16.18</s:span><s:br/> <s:span fontStyle="italic">Ash content (grams per 100g) 2</s:span><s:br/> <s:span fontStyle="italic">Carbohydrate content (grams per 100g) 21.26</s:span><s:br/> <s:span fontStyle="italic">Dietary Fiber content (grams per 100g) N/A</s:span><s:br/> <s:span fontStyle="italic">Sugar content (grams per 100g) N/A</s:span><s:br/> </s:RichText>
?
2.在左侧放置一个lable
注意rotation属性,它让这个lable旋转
<s:HGroup verticalAlign="top" width="100%" height="200"> <s:Label text="Calorie Information" fontWeight="bold" rotation="270"/> <s:RichText width="100%" lineHeight="20"> <s:span fontStyle="italic">Water content (grams per 100g) 47.31</s:span><s:br/> <s:span fontStyle="italic">Calorie content of Food (kcals per 3.5oz) 283</s:span><s:br/> <s:span fontStyle="italic">Protein content (grams per 100g) 13.25</s:span><s:br/> <s:span fontStyle="italic">Fat content (lipids) (grams per 100g) 16.18</s:span><s:br/> <s:span fontStyle="italic">Ash content (grams per 100g) 2</s:span><s:br/> <s:span fontStyle="italic">Carbohydrate content (grams per 100g) 21.26</s:span><s:br/> <s:span fontStyle="italic">Dietary Fiber content (grams per 100g) N/A</s:span><s:br/> <s:span fontStyle="italic">Sugar content (grams per 100g) N/A</s:span><s:br/> </s:RichText> </s:HGroup>??