一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

拖动及动态遮罩

时间:2022-07-02 17:08:54 编辑:袖梨 来源:一聚教程网

码如下:

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为导入的一背景图片转的影片剪辑

热门栏目