FLEX4中如何通过textFiledClass样式给Halo/MXlist设置CFF/DefineFont4字体的例子
2011-09-16 15:40
239 查看
转载的代码,本人也是刚刚入门,所以添加不上解释,望有高手可以添加一下注释以供学习接下来的例子演示了Flex 4中如何通过textFieldClass样式设置mx.core.UIFTETextField类,给Halo/MX List设置CFF/DefineFont4字体。
<?xmlversion="1.0"encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2009/11/17/using-a-cff-embedded-font-with-a-halo-list-control-in-flex-4/ -->
<s:Application name="Halo_List_textFieldClass_test"
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo">
<s:controlBarContent>
<s:Label id="sdkVer"
fontFamily="df4ster"
fontSize="24"
initialize="sdkVer.text = mx_internal::VERSION;" />
</s:controlBarContent>
<fx:Style>
@namespace s "library://ns.adobe.com/flex/spark";
@namespace mx "library://ns.adobe.com/flex/halo";
@font-face {
src: url("C:/Windows/Fonts/Arial.ttf");
embedAsCFF: true;
fontFamily: df4ster;
}
mx|List {
color: red;
fontFamily: df4ster;
fontSize: 16;
textFieldClass: ClassReference("mx.core.UIFTETextField");
}
</fx:Style>
<mx:List id="lst"
width="200"
horizontalCenter="0" verticalCenter="0">
<mx:dataProvider>
<mx:ArrayList>
<fx:Object label="Button"icon="@Embed('assets/Button.png')"/>
<fx:Object label="ButtonBar"icon="@Embed('assets/ButtonBar.png')"/>
<fx:Object label="CheckBox"icon="@Embed('assets/CheckBox.png')"/>
<fx:Object label="DataGroup"icon="@Embed('assets/DataGroup.png')"/>
<fx:Object label="HGroup"icon="@Embed('assets/HGroup.png')"/>
<fx:Object label="HScrollBar"icon="@Embed('assets/HScrollBar.png')"/>
<fx:Object label="HSlider"icon="@Embed('assets/HSlider.png')"/>
<fx:Object label="Label"icon="@Embed('assets/Label.png')"/>
<fx:Object label="List"icon="@Embed('assets/List.png')"/>
</mx:ArrayList>
</mx:dataProvider>
</mx:List>
</s:Application>
<?xmlversion="1.0"encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2009/11/17/using-a-cff-embedded-font-with-a-halo-list-control-in-flex-4/ -->
<s:Application name="Halo_List_textFieldClass_test"
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo">
<s:controlBarContent>
<s:Label id="sdkVer"
fontFamily="df4ster"
fontSize="24"
initialize="sdkVer.text = mx_internal::VERSION;" />
</s:controlBarContent>
<fx:Style>
@namespace s "library://ns.adobe.com/flex/spark";
@namespace mx "library://ns.adobe.com/flex/halo";
@font-face {
src: url("C:/Windows/Fonts/Arial.ttf");
embedAsCFF: true;
fontFamily: df4ster;
}
mx|List {
color: red;
fontFamily: df4ster;
fontSize: 16;
textFieldClass: ClassReference("mx.core.UIFTETextField");
}
</fx:Style>
<mx:List id="lst"
width="200"
horizontalCenter="0" verticalCenter="0">
<mx:dataProvider>
<mx:ArrayList>
<fx:Object label="Button"icon="@Embed('assets/Button.png')"/>
<fx:Object label="ButtonBar"icon="@Embed('assets/ButtonBar.png')"/>
<fx:Object label="CheckBox"icon="@Embed('assets/CheckBox.png')"/>
<fx:Object label="DataGroup"icon="@Embed('assets/DataGroup.png')"/>
<fx:Object label="HGroup"icon="@Embed('assets/HGroup.png')"/>
<fx:Object label="HScrollBar"icon="@Embed('assets/HScrollBar.png')"/>
<fx:Object label="HSlider"icon="@Embed('assets/HSlider.png')"/>
<fx:Object label="Label"icon="@Embed('assets/Label.png')"/>
<fx:Object label="List"icon="@Embed('assets/List.png')"/>
</mx:ArrayList>
</mx:dataProvider>
</mx:List>
</s:Application>
相关文章推荐
- Flex中通过设置textAlign样式在一个List控件中改变文本对齐方向的例子
- Flex的NumericStepper控件中如何通过textAlign样式设置文本对齐方式的例子
- Flex中如何通过设置fontFamily样式在ComboBox控件中使用自定义嵌入字体的例子
- Flex中如何通过leading样式在一个text控件中设置文本铅框(text leading)的例子
- Flex中如何通过设置textAlign样式设定DateField中选中日期对齐方式的例子
- Flex中如何通过设置fontFamily样式在NumericStepper控件中使用嵌入字体的例子
- Flex的滑标控件HSlider中如何通过tickThickness样式设置标尺厚度/宽度的例子
- Flex中如何通过borderStyle和borderSides样式设置NumericStepper控件特定边框(上下左右边)的例子
- Flex中如何通过设置tickLength样式设定HSlider控件上一个标记号(tick)长度的例子
- Flex中如何通过给openItems属性设置一个XMLList或Array对象来打开Tree的一个节点的例子
- Flex 4中如何设置TextFlow内超链接样式的例子
- Flex中如何通过borderThickness样式设置NumericStepper控件边框厚度的例子
- 通过Span设置TextView中字体的样式、大小
- Flex中如何通过getHeaderAt()函数以及selectedUpIcon,selectedOverIcon和selectedDownIcon样式给Accordion头部设置一个分割用图标的例子
- Flex中如何通过disabledColor样式设置NumericStepper控件无效时文本颜色的例子
- Flex中如何通过设置separatorWidth样式来设定LinkBar控件各项目间分隔宽度的例子
- Flex Gumbo中如何通过textRotation样式,设置TextGraphic文字旋转方向
- Flex中如何通过设定headerStyleName样式在Accordion控件中使用嵌入字体的例子
- Flex中如何通过itemRollOverColor和itemSelectionColor样式给列图ColumnChart设置选中/未选颜色的例子
- Flex Gumbo中如何通过textAlpha样式,设置TextGraphic透明度