Flash CS3鼠标的拖动果

来源:百度知道 编辑:UC知道 时间:2024/06/08 16:07:49
求使用Flash CS3实现以下效果
拖动一个图形到特定位置(一个圆)一旦进入这个区域,图形吸附到圆心,否则回到原位
魔法师的代码出现了很多迁移问题的警告啊!

在舞台上制作两个圆形的MC,分别命名,small_ball,big_ball;

在第一帧加入如下代码,当然还有些地方需要优化:
small_ball.onMouseDown = function() {
if (small_ball.hitTest(big_ball)) {
small_ball._x = big_ball._x;
small_ball._y = big_ball._y;
} else {
this.startDrag(true);
}
};
small_ball.onMouseUp = function() {
this.stopDrag();
};

去网上搜搜看