獲得兩點之間的距離

使用香草數學:

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);