用鼠标在小球的其它地方点击:
代码:
import flash.geom.Point;
this.onMouseDown = function() {
var p1:Point = new Point(mc._x, mc._y);
var p2:Point = new Point(_xmouse, _ymouse);
var d:Point = p2.subtract(p1);
d.normalize(10);
mc.onEnterFrame = function() {
var v = p1.add(d);
p1.x = mc._x=v.x;
p1.y = mc._y=v.y;
if (d.x>0 && p1.x>=p2.x || d.x<0 && p1.x<=p2.x) {
delete mc.onEnterFrame;
}
};
};