[Flex] PopUpButton系列——CornerRadius的运用

<?xml version="1.0" encoding="utf-8"?>
<!--设置主按钮圆角半径 PopUpButtonCornerRadius.mxml-->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"> <fx:Script> <![CDATA[ import mx.controls.Menu; import mx.events.FlexEvent; protected function popUpButton_initializeHandler(event:FlexEvent):void { var menu:Menu = new Menu(); menu.dataProvider = arr; popUpButton.popUp = menu; } protected function resizePopUp(event:FlexEvent):void { popUpButton.popUp.width = popUpButton.width; } ]]> </fx:Script> <fx:Declarations> <!-- 将非可视元素(例如服务、值对象)放在此处 --> <fx:Array id="arr"> <fx:Object label="《霹雳先锋》香港票房8916612" actor="Steven Chow"/> <fx:Object label="《捕风汉子》香港票房3149395" actor="Steven Chow"/> <fx:Object label="《小偷阿星》香港票房7968106 " actor="Steven Chow"/> <fx:Object type="separator"/> <fx:Object label="笑傲江湖之东方不败(1992)" actor="Jet Li"/> <fx:Object label="精武英雄(1994)" actor="Jet Li"/> <fx:Object label="给爸爸的信(1995)" actor="Jet Li"/> </fx:Array> </fx:Declarations> <fx:Style> @namespace s "library://ns.adobe.com/flex/spark"; @namespace mx "library://ns.adobe.com/flex/mx"; mx|PopUpButton { popUpStyleName: myCustomPopUpStyleName; } .myCustomPopUpStyleName { fontWeight: normal; textAlign: left; leftIconGap: 0; } </fx:Style> <s:controlBarContent> <s:Form styleName="plain"> <s:FormItem label="cornerRadius:"> <!--<s:HSlider id="slider" minimum="0" maximum="{popUpButton.height/2}" value="0" liveDragging="true" snapInterval="1" />--> <mx:HSlider id="slider" minimum="0" maximum="{10}" value="0" liveDragging="true" snapInterval="1" tickInterval="1" /> </s:FormItem> </s:Form> </s:controlBarContent> <mx:PopUpButton id="popUpButton" label="Please select an item..." cornerRadius="{slider.value}" arrowButtonWidth="{popUpButton.height}" openAlways="true" initialize="popUpButton_initializeHandler(event)" creationComplete="resizePopUp(event)"/> </s:Application>

 

你可能感兴趣的:([Flex] PopUpButton系列——CornerRadius的运用)