Flex中通过focusAlpha样式设置NumericStepper控件获取光标时透明度的例子

By Minidxer | May 25, 2008

接下来的例子演示了Flex中如何通过focusAlpha样式,设置NumericStepper控件获取光标时透明度。Demo中点击“click here to remove focus”按钮移除光标,上下按钮调整透明度。

让我们先来看一下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:Script>
  8.         <![CDATA[
  9.             import mx.events.NumericStepperEvent;
  10.  
  11.             private function numericStepper_change(evt:NumericStepperEvent):void {
  12.                 // reset focus
  13.                 focusManager.setFocus(btn);
  14.                 focusManager.setFocus(numericStepper);
  15.             }
  16.         ]]>
  17.     </mx:Script>
  18.  
  19.     <mx:ApplicationControlBar dock="true">
  20.         <mx:Button id="btn" label="click here to remove focus" />
  21.     </mx:ApplicationControlBar>
  22.  
  23.     <mx:NumericStepper id="numericStepper"
  24.             minimum="0.0"
  25.             maximum="1.0"
  26.             value="0.5"
  27.             stepSize="0.1"
  28.             textAlign="center"
  29.             focusAlpha="{numericStepper.value}"
  30.             change="numericStepper_change(event);" />
  31.  
  32. </mx:Application>
代码:Peter deHaan 翻译/整理/编译:minidxer

Topics: Flex | Tags: , , , ,

Related Post

Leave a Comment

Name(*):

E-Mail(*) :

Website :

Comments :

Search Posts

Archives

Sponsored Ads