遮敝掉不能按的部份~
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" creationComplete="application1_creationCompleteHandler(event)"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Script>
<![CDATA[
import flash.display.Sprite;
import mx.events.FlexEvent;
protected function application1_creationCompleteHandler(event:FlexEvent):void
{
var sp:Sprite=new Sprite();
sp=DrawCircleMask.drawMask(this.width,this.height,100,100,50);
dd.addChild(sp);
}
protected function dd_clickHandler(event:MouseEvent):void
{
trace("click");
}
]]>
</fx:Script>
<mx:SWFLoader id="dd" click="dd_clickHandler(event)"/>
</s:Application>
DrawCircleMask.as
package
{
import flash.display.MovieClip;
import flash.display.Sprite;
public class DrawCircleMask
{
public function DrawCircleMask(){}
public static function drawMask(_w:uint,_h:uint,_x:uint,_y:uint,_r:uint,_c:uint=0x000000):Sprite
{
var shape:MovieClip=new MovieClip()
shape.graphics.beginFill(0x0000ff,1);
shape.graphics.drawRect(0,0,_w,_h);
shape.graphics.drawCircle(_x,_y,_r);
shape.graphics.endFill();
return shape;
}
}
}
沒有留言:
張貼留言