本源代码来源于flex完全自学手册
一些按钮的操作:
<?xml version="1.0" encoding="utf-8"?>
<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">
<s:layout>
<s:BasicLayout/>
</s:layout>
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>
<mx:Panel width="434" height="275" layout="absolute">
<mx:Button label="按钮" toggle="true" color="#ff0000" width="147" x="20" y="10"/>
<mx:Text text="改变按钮字体颜色" x="175" y="10"/>
<mx:Button label="button" width="147" borderColor="#ff00ff" cornerRadius="14" x="20" y="40"/>
<mx:Text x="175" y="40" text="改变按钮边框颜色和四角弧度" width="182"/>
<mx:Button x="20" y="70" label="button" width="147" fillColors="[#8000ff,#8000ff]"/>
<mx:Text x="175" y="70" text="改变按钮填充颜色" width="182"/>
<mx:Button x="20" y="100" label="button" width="147" themeColor="#008040" />
<mx:Text x="175" y="101" text="改变鼠标单击时颜色" width="219"/>
<mx:Button x="20" y="130" label="button" width="147" disabledColor="#00ff00" enabled="false"/>
<mx:Text x="175" y="132" text="按钮不可用时字体的颜色"/>
<mx:Button x="20" y="160" label="button" width="147" icon="@Embed('search_new.gif')"/>
<mx:Text x="175" y="185" text="定义按钮图标" />
</mx:Panel>
</s:Application>
<!--
仅主题为“halo”的类型“mx.controls.Button”支持样式“fillColors”
-->
运行效果,我再贴出来。
这个里面有一个主题的思想,请大家上网查找一下flex主题的意思。