Flex中通过errorColor样式和errorString属性自定义TextInput控件发生错误时颜色的例子

By Minidxer | August 19, 2008

接下来的例子演示了Flex中如何通过errorColor样式和errorString属性,自定义TextInput控件发生错误时颜色。

让我们先来看一下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="errorColor:" />
  9.         <mx:ColorPicker id="colorPicker" />
  10.     </mx:ApplicationControlBar>
  11.  
  12.     <mx:Form>
  13.         <mx:FormItem label="text:" required="true">
  14.             <mx:TextInput id="textInput"
  15.                     errorColor="{colorPicker.selectedColor}"
  16.                     errorString="Custom error color" />
  17.         </mx:FormItem>
  18.         <mx:FormItem>
  19.             <mx:Button />
  20.         </mx:FormItem>
  21.     </mx:Form>
  22.  
  23. </mx:Application>
代码:Peter deHaan 翻译/整理/编译:中文Flex例子

Topics: Flex | Tags: , ,

Related Post

Leave a Comment

Name(*):

E-Mail(*) :

Website :

Comments :

Search Posts

Archives

Sponsored Ads