Flex 图像处理: 黑白滤镜

Categories: Flex; Tagged with: ; @ May 28th, 2009 22:41

需求: 在某些时候, 如客户下线, 须将头像一类的图片变为黑白.

解决: 使用颜色矩阵滤镜.

效果: 如下图:

image

姓名后坠有"/黑白"[Absent]的图像为滤镜使用后的效果

使用方法:

当用户考勤状态为Present时:

//如果没有使用其他滤镜, 直接简写为:

_img.filters = [new ColorMatrixFilter([0.3086, 0.6094, 0.0820, 0, 0, 0.3086, 0.6094, 0.0820, 0,
0, 0.3086, 0.6094, 0.0820, 0, 0, 0, 0, 0, 1, 0])];

当状态为Absent时:

_img.filters = null;  // 去除黑白滤镜, 注意如果使用了其他滤镜, 则应单独从filters数组中除去黑白滤镜, 而不应直接设为null.

———————————-无关紧要的分割线—————————————–
另: new ColorMatrixFilter([0.3086, 0.6094, 0.0820, 0, 0, 0.3086, 0.6094, 0.0820, 0,
0, 0.3086, 0.6094, 0.0820, 0, 0, 0, 0, 0, 1, 0]) 的完整版:

var red:Number = 0.3086;
var green:Number = 0.694;
var blue:Number = 0.0820; //这三个值是提供标准的黑白效果
var cmf:ColorMatrixFilter = new ColorMatrixFilter(red, green, blue, 0, 0, red, green, blue, 0, 0, red, green, blue, 0, 0, 0, 0, 0, 1, 0);

Flex: 自适应大小TextArea, Resizable TextArea

Categories: Flex; Tagged with: ; @ May 8th, 2009 23:53

Flex3中: http://www.flexer.info/2009/02/06/auto-resizable-text-area-component/

Flex4 Spark组件已支持自适应高度: http://liguoliang.com/2010/auto-resizable-text-area-component/

Flex Int转String

Categories: Flex; Tagged with: ; @ April 24th, 2009 8:46

打印ABCD:

            	for(var i:int = 65; i < 69; i++) {
            		trace(String.fromCharCode(i));
            	}

结果:

A

B

C

D

Flex: 通过监听Event实现UI组件的Validation

Categories: Flex; Tagged with: ; @ April 23rd, 2009 14:28


textInputScore.addEventListener(Event.CHANGE, onTextInputScoreChange); // 监听Change事件
	// 检测成绩输入是否有效: 1. 必须为Number; 2. 必须小于最高分

		//if(isNaN(parseFloat(textInputScore.text))) { //错误, 形如2w之类将不报错....
		if(isNaN(Number(textInputScore.text))) {
			textInputScore.errorString = RM.getString(BUNDEL_ONLINETEST, "olt.grading.errorMessage.nan", [textInputScore.text]);
		}else if(parseFloat(textInputScore.text) > _questionAttempt.question.marksCorrrect) {
			textInputScore.errorString = RM.getString(BUNDEL_ONLINETEST, "olt.grading.errormessage.outScop", [textInputScore.text, _questionAttempt.question.marksCorrrect]);
		}else {
			textInputScore.errorString = null;
		}
	}

Tour de Flex 发布1.2版,增加在线版本

Categories: Flex; Tagged with: ; @ April 4th, 2009 11:11

Tour de Flex主页: http://www.adobe.com/devnet/flex/tourdeflex.

Web版: http://www.adobe.com/devnet/flex/tourdeflex/web

Newer Posts <-> Older Posts



// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.