当前位置:软件学习 > Flash >>

拖动及动态遮罩

码如下:

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

补充:flash教程,As3.0
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,