
转载请保持文章完整性!
本文链接地址:http://blog.desizen.com/4lone/317.html
主页:joel's blog
这个例子进行的是UI Controls:Buttons:Button
这个例子用到了一些图片,按这里下载.下载后,存放在src目录内即可.
简介:
The Button control is a commonly used rectangular button. Button controls look like they can be pressed. They can have a text label, an icon, or both on their face.
例子:
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal" viewSourceURL="srcview/index.html" verticalAlign="middle" horizontalAlign="center" backgroundGradientColors="[0x000000,0x323232]"> <!--这个例子实现的是一个用自定义样式图片来给button按钮不同的显示风格的例子--> <mx:Script> <![CDATA[ import mx.controls.Alert; ]]> </mx:Script> <mx:Panel title="Button Control Example" layout="vertical" height="100" color="0xffffff" borderAlpha="0.15" paddingTop="10" paddingRight="10" paddingBottom="10" paddingLeft="10" horizontalAlign="center"> <mx:HBox horizontalGap="10" verticalAlign="middle"> <!-- normal button --> <mx:Button id="defaultButton" color="0x323232" label="Default Button" click="{Alert.show('Default Button Pressed');}" /> <mx:Button id="iconButton" label="Button With Icon" labelPlacement="right" paddingLeft="2" icon="@Embed('assets/flex_icon.png')" downIcon="@Embed('assets/flex_icon_dwn.png')" color="0x323232" click="{Alert.show('Button With Icon Pressed');}" /><!--带有icon小图标的按钮--> <mx:Button id="skinnedButton" label="Skinned Button" width="150" upSkin="@Embed('assets/btn_up.png')" overSkin="@Embed('assets/btn_over.png')" downSkin="@Embed('assets/btn_down.png')" focusSkin="@Embed('assets/btn_focus.png')" disabledSkin="@Embed('assets/btn_disabled.png')" color="0x323232" textRollOverColor="0xffffff" textSelectedColor="0xffffff" paddingLeft="20" click="{Alert.show('Skinned Button Pressed');}" /><!--button的一些样式设置,整个button完全由样式图片来显示--> <mx:Button id="customButton" label="CUSTOM BUTTON" fontFamily="Arial" fontStyle="italic" fontWeight="normal" cornerRadius="12" color="0xffffff" fillColors="[0x55C0FF,0x0050AA]" fillAlphas="[1.0,1.0]" highlightAlphas="[1.0,0.2]" focusAlpha="0.2" textRollOverColor="0xffffff" textSelectedColor="0x55C0FF" click="{Alert.show('CUSTOM BUTTON Pressed');}" borderColor="#B7BABC"/> </mx:HBox> </mx:Panel> </mx:Application>
标签:Button, FLEX, TourDeFlex, 例子

点了