
Код:
this.createEmptyMovieClip("square_mc", 0)
this.square_mc.beginFill(0xCCCCCC, 100)
this.square_mc.lineTo(100, 0)
this.square_mc.lineTo(100, 100)
this.square_mc.lineTo(0, 100)
this.square_mc.endFill()
this.square_mc._x = this.square_mc._y = 100
this.square_mc.onEnterFrame = function() {
this.setRotation(this._rotation+1, this.x_center, this.y_center)
// this._x ++
}
this.square_mc.setRotation = function (rotation, x_center, y_center) {
var old_obj = {x:x_center, y:y_center}
var new_obj = {x:x_center, y:y_center}
this.localToGlobal(old_obj)
this._rotation = rotation
this.localToGlobal(new_obj)
this._x +=old_obj.x-new_obj.x
this._y +=old_obj.y-new_obj.y
}
this.square_mc.onPress = function () {
this.x_center = this._xmouse
this.y_center = this._ymouse
}