<mx:Application>
<mx:Script>
private function onColorChange():void
{
can.removeAllChildren();
var loader:Loader = new Loader();
loader.load(new URLRequest( assets/images/logo/1.png ));
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,onComplete);
/* image= new Image();
image.source = "assets/images/logo/1.jpg";
image.setStyle( horizontalCenter , 0 );
image.setStyle( verticalCenter , 0 ); */
//can.addChild(image);
txt= new Text();
txt.text = "Ankur sharma";
txt.styleName = "font";
txt.setStyle( fontFamily , Anime Ace );
txt.rotation = -10;
can.addChild(txt);
can.mask = txt;
//applyFilter(CC.uint2rgb(cp.selectedColor));
}
private function onComplete(event:Event):void
{
rect = new Rectangle();
rect = txt.getBounds(can);
can.graphics.clear();
can.graphics.beginBitmapFill(event.currentTarget.content.bitmapData);
can.graphics.drawRect(rect.x,rect.y,rect.width,rect.height);
can.graphics.endFill();
}
</mx:Script>
<mx:ColorPicker id="cp" change="onColorChange()"/>
<mx:Canvas id="can" height="100%" horizontalCenter="0" verticalCenter="0" borderStyle="solid" borderColor="#CCCCCC" borderThickness="5">
<mx:Image source="assets/images/logo/1.png" horizontalCenter="0" verticalCenter="0"/>
<mx:Text text="Ankur Sharma" styleName="font" rotation="-10"/>
</mx:Canvas>
<mx:Style source="style.css"/>
</mx:Application>
在本例中,我所做的是删除ma canvas(id=can)中的所有子项,然后进行n个更改,以退出组件,然后将thm添加回canvas,
这个程序是用多种方式屏蔽的,我的画布有两个孩子,我把ma文本作为掩码放在画布上,我用位图图像填充画布,就是这样
我跳到它hepls