[代码]
//画两小圆
var yuan1:Sprite=new Sprite();
yuan1.graphics.beginFill(0x000000);
yuan1.graphics.drawCircle(0,0,5);
addChild(yuan1);
yuan1.x=100;
yuan1.y=100;
var yuan2:Sprite=new Sprite();
yuan2.graphics.beginFill(0x000000);
yuan2.graphics.drawCircle(0,0,5);
addChild(yuan2);
yuan2.x=130;
yuan2.y=140;
//显赫距离的动态文本
var _txt:TextField=new TextField();
_txt.autoSize=TextFieldAutoSize.LEFT;
addChild(_txt);
//定义直线精灵
var zhixian:Sprite=new Sprite();
addChild(zhixian);
//圆1拖动和停止拖动
yuan1.buttonMode=true;
yuan1.addEventListener(MouseEvent.MOUSE_DOWN,yuan1ax);
function yuan1ax(event:MouseEvent):void {
yuan1.startDrag();
}
yuan1.addEventListener(MouseEvent.MOUSE_MOVE,yuan1yd);
function yuan1yd(event:MouseEvent):void {
event:gx;
}
yuan1.addEventListener(MouseEvent.MOUSE_UP,yuan1sk);
function yuan1sk(event:MouseEvent):void {
yuan1.stopDrag();
}
stage.addEventListener(MouseEvent.MOUSE_UP,yuan1yc);
function yuan1yc(event:MouseEvent):void {
yuan1.stopDrag();
}
//圆2拖动和停止拖动
yuan2.buttonMode=true;
yuan2.addEventListener(MouseEvent.MOUSE_DOWN,yuan2ax);
function yuan2ax(event:MouseEvent):void {
yuan2.startDrag();
}
yuan2.addEventListener(MouseEvent.MOUSE_MOVE,yuan2yd);
function yuan2yd(event:MouseEvent):void {
event:gx;
}
yuan2.addEventListener(MouseEvent.MOUSE_UP,yuan2sk);
function yuan2sk(event:MouseEvent):void {
yuan2.stopDrag();
}
stage.addEventListener(MouseEvent.MOUSE_UP,yuan2yc);
function yuan2yc(event:MouseEvent):void {
yuan2.stopDrag();
}
//更新
stage.addEventListener(Event.ENTER_FRAME,gx);
function gx(event:Event):void {
zhixian.graphics.clear();
var zuobiao1oint = new Point(yuan1.x, yuan1.y);
var zuobiao2oint = new Point(yuan2.x, yuan2.y);
var juli:Number = Point.distance(zuobiao1, zuobiao2);
zhixian.graphics.lineStyle(2,0xFF0000,1);
zhixian.graphics.moveTo(yuan1.x,yuan1.y);
zhixian.graphics.lineTo(yuan2.x,yuan2.y);
_txt.text="两点间距离:"+uint(juli*10)/10;
}
我的博物馆故事 官方安卓版v1.61.2
我的博物馆故事是一款以消除为主题的经营养成类手游,在这里玩家
专业模拟飞行10 手机版v12.2.4
专业模拟飞行10安卓版是一款飞行休闲手游,顶尖的物理飞行引擎
动物起义战斗模拟器二琳同款 最新版v4.1.1
动物起义战斗模拟器是一个非常有趣的模拟类游戏,玩家可以召唤各
迷你世界七周年 安卓手机版v1.43.0
迷你世界7周年是一款由《迷你世界》官方推出的庆祝特别版本,在
劫后公司无限资源版 v1.0.5.1
劫后公司内置菜单版是游戏的破解版本,在该版本中为玩家提供了内