Flex中如何通过popUpStyleName和fontWeight样式设置PopUpButton标签字体粗细的例子
By Minidxer | March 2, 2009
接下来的例子演示了Flex中如何通过popUpStyleName和fontWeight样式,设置PopUpButton标签字体粗细。
让我们先来看一下Demo(可以右键View Source或点击这里察看源代码):
下面是完整代码(或点击这里察看):
Download: main.mxml
- <?xml version="1.0"?>
- <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
- layout="horizontal"
- verticalAlign="top"
- backgroundColor="white">
- <mx:Script>
- <![CDATA[
- import mx.controls.Menu;
- [Bindable]
- private var menu:Menu;
- private function initMenu():void {
- menu = new Menu();
- menu.dataProvider = arr;
- }
- ]]>
- </mx:Script>
- <mx:Array id="arr">
- <mx:Object label="Button" />
- <mx:Object label="ButtonBar" />
- <mx:Object label="ColorPicker" />
- <mx:Object label="ComboBox" />
- </mx:Array>
- <mx:Style>
- PopUpButton {
- popUpStyleName: myCustomPopUpStyleName;
- }
- .myCustomPopUpStyleName {
- fontWeight: normal;
- textAlign: left;
- }
- </mx:Style>
- <mx:PopUpButton id="popUpButton"
- label="Select a control…"
- popUp="{menu}"
- preinitialize="initMenu();"
- creationComplete="popUpButton.open();" />
- </mx:Application>
代码:Peter deHaan 翻译/整理/编译:中文Flex例子
Topics:
PopUpButton |
No Comments » |
131 views
Tags: fontWeight, PopUpButton, popUpStyleName