Flex中按钮颜色相关的color, disabledColor, textRollOverColor和textSelectedColor样式的例子

By Minidxer | August 12, 2008

接下来的例子演示了Flex中利用color, disabledColor, textRollOverColor和textSelectedColor样式,设置有效状态和无效状态下按钮颜色。

让我们先来看一下Demo可以右键View Source或点击这里察看源代码):


下面是完整代码(或点击这里察看):

Download: main.mxml
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
  3.         layout="vertical"
  4.         verticalAlign="middle"
  5.         backgroundColor="white">
  6.  
  7.     <mx:ApplicationControlBar dock="true">
  8.         <mx:Label text="color:" />
  9.         <mx:ColorPicker id="colorCB" />
  10.  
  11.         <mx:Spacer width="33%" />
  12.  
  13.         <mx:Label text="textRollOverColor:" />
  14.         <mx:ColorPicker id="textRollOverColorCB" />
  15.  
  16.         <mx:Spacer width="33%" />
  17.  
  18.         <mx:Label text="textSelectedColor:" />
  19.         <mx:ColorPicker id="textSelectedColorCB" />
  20.  
  21.         <mx:Spacer width="33%" />
  22.  
  23.         <mx:Label text="disabledColor:" />
  24.         <mx:ColorPicker id="disabledColorCB" />
  25.         <mx:CheckBox id="enabledCh" label="enabled" selected="true" />
  26.     </mx:ApplicationControlBar>
  27.  
  28.     <mx:Button id="button"
  29.             label="Label"
  30.             toggle="true"
  31.             enabled="{enabledCh.selected}"
  32.             color="{colorCB.selectedColor}"
  33.             disabledColor="{disabledColorCB.selectedColor}"
  34.             textRollOverColor="{textRollOverColorCB.selectedColor}"
  35.             textSelectedColor="{textSelectedColorCB.selectedColor}" />
  36.  
  37. </mx:Application>
代码:Peter deHaan 翻译/整理/编译:中文Flex例子

Topics: Flex | Tags: , , , ,

Related Post

Leave a Comment

Name(*):

E-Mail(*) :

Website :

Comments :

Search Posts

Archives

Sponsored Ads