使用香草数学:
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; // 要么 var distance:Number = Point.distance(to, from);