获得两点之间的距离
使用香草数学:
var from:Point = new Point(300, 10);
var to:Point = new Point(75, 40);
var a:Number = to.x - from.x;
var b:Number = to.y - from.y;
var distance:Number = Math.sqrt(a * a + b * b);
使用 Point
的内置函数 :
var distance:Number = to.subtract(from).length; // or
var distance:Number = Point.distance(to, from);