[code as3]
package
{
import flash.display.Sprite;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.geom.Point;
public class Length extends Sprite
{
public function Length()
{
super();
configureListener();
}
private var circle:Circle;
public function configureListener():void
{
if(!circle)
{
circle = new Circle();
circle.x = stage.stageWidth / 2;
circle.y = stage.stageHeight / 2;
addChild(circle);
}
circle.addEventListener(MouseEvent.MOUSE_DOWN, ptMouseDownHaldner);
circle.addEventListener(MouseEvent.MOUSE_UP, ptMouseUpHandler);
}
function ptMouseDownHaldner(event:MouseEvent):void
{
circle.startDrag(false, null);
}
function ptMouseUpHandler(event:MouseEvent):void
{
circle.stopDrag();
var point1:Point = new Point(circle.x, circle.y);
length_txt.text = point1.length.toString();
}
}
}
[/code]
댓글 없음:
댓글 쓰기