哪位大哥帮小弟详细解释一下这段代码
这段代码是MX自带的例子360_degrees.fla,偶刚开始学习AS,E文又太菜,看着有点晕,哪位好心人帮小弟详细解释一下??
// declare and set initial variables and properties
with (puck) {
initx = _x;
inity = _y;
top = _y-97;
bottom = _y+97;
left = _x-97;
right = _x+97;
}
//
_root.onEnterFrame = function() {
with (puck) {
// make circle continuously rotate
_rotation += 10;
//
// calculate distance from starting point
delta_x = _x-initx;
delta_y = _y-Inity;
distance = Math.sqrt((delta_x*delta_x)+(delta_y*delta_y));
}
//
// calculate the angle from the starting point in radians
radians = Math.atan2(delta_y, delta_x);
if (delta_y<0) {
radians += (2*Math.PI);
}
//
// convert radians to degrees
degrees = Math.floor(radians/(Math.PI/180));
};
//
// make puck draggable
puck.onPress = function() {
startDrag(puck, false, left, top, right, bottom);
};
puck.onRelease = function() {
stopDrag();
};
//
// reset button
reset.onRelease = function() {
puck._x = initx;
puck._y = inity;
};