Flex中的TextInput (2):画出边框---Graphics
来源:互联网 发布:淘宝转化率计算 编辑:程序博客网 时间:2024/05/18 12:05
让我们尝试从零构建Flex3中的TextInput控件。
用Graphics画出立体感:逐一测试draw3dBorder函数中的各个画图部分,可以知道TextInput控件边框是如何一步一步画出来的。
Test3DBorder.as
package {import flash.display.Graphics;import flash.display.Sprite;import mx.utils.ColorUtil;/** * 该例代码改编自FlexSDK中的TextInput控件 * 基本忠于SDK中的源代码 */public class Test3DBorder extends Sprite{//定义高度和宽度public var w:int;public var h:int;public function Test3DBorder(){w = 200;h = 20;drawBorder();}public function drawBorder():void{//定义边框颜色var borderColor:uint;var borderColorDrk1:uintvar borderColorDrk2:uintvar borderColorLt1:uintvar borderInnerColor:uint;//设定边框颜色borderColor = 0xb7babc;borderColorDrk1 =ColorUtil.adjustBrightness2(borderColor, -40);borderColorDrk2 =ColorUtil.adjustBrightness2(borderColor, +25);borderColorLt1 = ColorUtil.adjustBrightness2(borderColor, +40);borderInnerColor = 0xffffff;//画出3D边框效果draw3dBorder(borderColorDrk2, borderColorDrk1, borderColorLt1, Number(borderInnerColor), Number(borderInnerColor), Number(borderInnerColor));}public function draw3dBorder(c1:Number, c2:Number, c3:Number, c4:Number, c5:Number, c6:Number):void{var g:Graphics = graphics;g.clear();// outside sidesg.beginFill(c1);g.drawRect(10, 10, w, h);g.drawRect(11, 10, w - 2, h);g.endFill();// outside topg.beginFill(c2);g.drawRect(11, 10, w - 2, 1);g.endFill();// outside bottomg.beginFill(c3);g.drawRect(11, 10 + h - 1, w - 2, 1);g.endFill();// inside topg.beginFill(c4);g.drawRect(11, 11, w - 2, 1);g.endFill();// inside bottomg.beginFill(c5);g.drawRect(11, 10 + h - 2, w - 2, 1);g.endFill();// inside sidesg.beginFill(c6);g.drawRect(11, 12, w - 2, h - 4);g.drawRect(12, 12, w - 4, h - 4);g.endFill();}}}
效果图:
- Flex中的TextInput (2):画出边框---Graphics
- Flex中的TextInput (3):组合---TextField类 + 边框(Graphics)
- Flex中的TextInput (4):控件化
- Flex隐藏TextInput的边框及背景
- Flex中的TextInput (6): 示例和Flex中真实的TextInput的不同
- Flex中的TextInput (1):Flex3和Flex4的不同
- Flex中的TextInput (5):添加焦点效果
- flex 中的textinput 也有阴影效果~
- Flex控件中的Graphics: CheckBox
- FLEX/获得textinput的字节(byte)
- flex textinput 输入限制(数字、字母)
- Flex中如何改变TextInput输入框得到焦点时边框颜色的例子
- Flex TextInput获取光标
- Flex样式-TextInput篇
- (C#)如何利用Graphics画出一幅图表
- Flex中的CSS: (3)CSS会被编译器转换为什么样的AS代码--派生:s|HGroup s|TextInput
- phpexcel画出单元格边框
- CSS画出边框三角形
- Java内存管理
- Tiling(P2506)
- php中正则的断言匹配
- 常用工具
- c语言实现顺序表的插入,删除和求给定元素在表中的位序等运算
- Flex中的TextInput (2):画出边框---Graphics
- 个人喜欢的命名方法
- java的AbstractAction类用法示例(利用java的AbstractAction处理事件)
- Android中json操作数据的使用
- js实现GBK编码
- 长跳转函数应用
- [刷题笔记] Codeforces 115B ,一个清楚的大脑
- 硬盘容量换算
- 字符串转换 A2T