Apr 13
接下来的例子演示了Flex中如何通过设置themeColor属性,改变TextInput输入框得到焦点时边框的颜色。
让我们先来看一下Demo(可以右键View Source或点击这里察看源代码):
下面是完整代码(或点击这里察看):
Download: main.mxml
- <?xml version="1.0" encoding="utf-8"?>
- <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
- layout="vertical"
- verticalAlign="middle"
- backgroundColor="white">
- <mx:Script>
- <![CDATA[
- import mx.events.DropdownEvent;
- import mx.events.ColorPickerEvent;
- private function colorPicker_change(evt:ColorPickerEvent):void {
- textInput.setStyle("themeColor", evt.color);
- }
- private function colorPicker_close(evt:DropdownEvent):void {
- focusManager.setFocus(textInput);
- }
- ]]>
- </mx:Script>
- <mx:ApplicationControlBar dock="true">
- <mx:Form styleName="plain">
- <mx:FormItem label="themeColor:">
- <mx:ColorPicker id="colorPicker"
- change="colorPicker_change(event);"
- close="colorPicker_close(event);" />
- </mx:FormItem>
- </mx:Form>
- </mx:ApplicationControlBar>
- <mx:TextInput id="textInput" />
- </mx:Application>
代码:Peter deHaan 翻译/整理/编译:minidxer
Related Post
2 Responses to “Flex中如何改变TextInput输入框得到焦点时边框颜色的例子”
Trackbacks
- Flex中通过borderColor样式设置NumericStepper控件边框颜色的例子 - 全文检索博客
- Flex中如何通过focusRoundedCorners样式在TextInput控件获得焦点后控制矩形对角圆滑与否的例子 - 全文检索博客
