17年餐饮品牌好项目:[Flash] MC绕圆心拖动

来源:百度文库 编辑:偶看新闻 时间:2024/04/29 09:06:43
var 圆心x:Number = 圆心._x;
var 圆心y:Number = 圆心._y;
var 半径:Number = Math.sqrt((卫星._x-圆心x)*(卫星._x-圆心x)+(卫星._y-圆心y)*(卫星._y-圆心y));
var 角度:Number = Math.atan2(_ymouse-圆心y, _xmouse-圆心x);
圆心.onPress = function() {
        this.startDrag();
};
卫星.onPress = function() {
        this.onEnterFrame = function() {
                角度 = Math.atan2(_root._ymouse-圆心y, _root._xmouse-圆心x);
                this._x = 圆心x+半径*Math.cos(角度);
                this._y = 圆心y+半径*Math.sin(角度);
        };
};
this.onMouseUp = function() {
        圆心.stopDrag();
        圆心x = 圆心._x;
        圆心y = 圆心._y;
        半径 = Math.sqrt((卫星._x-圆心x)*(卫星._x-圆心x)+(卫星._y-圆心y)*(卫星._y-圆心y));
        delete 卫星.onEnterFrame;
};

附件: MC绕圆心拖动.swf (2006-10-15 12:49, 5 K)
该附件被下载次数 6


附件: MC绕圆心拖动.fla (2006-10-15 12:49, 25.5 K)
该附件被下载次数 1