Flex 3 实现遮罩效果
第一种方法:使用mxml标签来表现
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:flash="flash.filters.*" xmlns:local="*">
?? <mx:Label text="flex中mxml标签来表现滤镜遮罩效果" fontSize="20">
???? <mx:filters>
????? <flash:DropShadowFilter distance="10" angle="45"/>
???? </mx:filters>
?? </mx:Label>
?? <mx:Label text="xiao? hui? lan" fontSize="20" filters="{[new DropShadowFilter(10, 45)]}"/>
</mx:Application>
?
?
第二种方法:使用as代码来实现滤镜遮罩效果
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:flash="flash.filters.*" xmlns:local="*">
<mx:Script>
?<![CDATA[
?import flash.filters.*;
?
?????? public function addFilter() : void
?????? {
?????????? var f:DropShadowFilter = new DropShadowFilter(5,30,0xFFFFFF,.8);
?????????? var myFilters:Array = new Array();
?????????? myFilters.push(f);
?????????? label1.filters = myFilters;
?????? }
?]]>
</mx:Script>
<mx:Label id="label1" text="使用as代码来实现滤镜遮罩效果" fontSize="20" creationComplete="addFilter()"/>
</mx:Application>