flex3 图片遮罩

来源:互联网 发布:java j2ee 区别 编辑:程序博客网 时间:2024/04/28 04:32

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="955" minHeight="600" creationComplete="application1_creationCompleteHandler(event)">

<mx:Script>

<![CDATA[

import mx.events.FlexEvent;

 

private var MyMask : Image = new Image();

 

protected function application1_creationCompleteHandler(event:FlexEvent):void

{

MyMask = new Image();

MyMask.graphics.lineStyle(1);

MyMask.graphics.beginFill(0xFFFFFF);

MyMask.graphics.drawRoundRect(0,0,hldr.width,hldr.height,20,20);

MyMask.graphics.endFill();

hldr.addChild(MyMask);

hldr.mask=MyMask;

 

}

 

]]>

</mx:Script>

<mx:Canvas id="hldr" width="400" height="300" verticalCenter="0" horizontalCenter="0">

<mx:Image x="0" y="0" width="100%" height="100%" source="Koala.jpg"/>

</mx:Canvas>

 

</mx:Application>

原创粉丝点击