拖动及动态遮罩

作者:袖梨 2022-07-02

码如下:

import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.geom.Rectangle
var rect:Rectangle = new Rectangle(80,120, 350, 160);
var circle:Sprite = new Sprite();
circle.graphics.beginFill(0xFFCC00);
circle.graphics.drawCircle(0, 0, 80);
circle.x=200
circle.y=200
addChild(circle);
circle.buttonMode=true
circle.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown);

function mouseDown(event:MouseEvent):void {
 circle.startDrag(true,rect);
}
circle.addEventListener(MouseEvent.MOUSE_UP, mouseReleased);

function mouseReleased(event:MouseEvent):void {
 circle.stopDrag();
}
mc.mask=circle
mc为导入的一背景图片转的影片剪辑

相关文章

精彩推荐