[quoted text, click to view] Jeckyl wrote:
>
> > You can as well adjust center point with actions script in run time.
> > Tho flash does not provide it but we have way around to do it.
>
> Do tell .. sounds interesting.
var MCP = MovieClip.prototype;
MCP._xreg = MCP._yreg = 0;
MCP.setPropRel = function (prop, amount) {
var a = {x:this._xreg, y:this._yreg};
this.localToGlobal (a);
this._parent.globalToLocal (a);
this[prop] = amount;
var b = {x:this._xreg, y:this._yreg};
this.localToGlobal (b);
this._parent.globalToLocal (b);
this._x -= b.x - a.x;
this._y -= b.y - a.y;
};
MCP.set_x2 = function (v) {
var a = {x:this._xreg, y:this._yreg};;
this.localToGlobal (a);
this._parent.globalToLocal (a);
this._x += v - a.x;
};
MCP.get_x2 = function () {
var a = {x:this._xreg, y:this._yreg};
this.localToGlobal (a);
this._parent.globalToLocal (a);
return a.x;
};
MCP.set_y2 = function (v) {
var a = {x:this._xreg, y:this._yreg};;
this.localToGlobal (a);
this._parent.globalToLocal (a);
this._y += v - a.y;
};
MCP.get_y2 = function () {
var a = {x:this._xreg, y:this._yreg};
this.localToGlobal (a);
this._parent.globalToLocal (a);
return a.y;
};
MCP.set_xscale2 = function (v) {
this.setPropRel ("_xscale", v);
};
MCP.get_xscale2 = function () {
return this._xscale;
};
MCP.set_yscale2 = function (v) {
this.setPropRel ("_yscale", v);
};
MCP.get_yscale2 = function () {
return this._yscale;
};
MCP.set_rotation2 = function (v) {
this.setPropRel ("_rotation", v);
};
MCP.get_rotation2 = function () {
return this._rotation;
};
MCP.get_xmouse2 = function () {
return this._xmouse - this._xreg;
};
MCP.get_ymouse2 = function () {
return this._ymouse - this._yreg;
};
with (MCP) {
addProperty ("_x2", get_x2, set_x2);
addProperty ("_y2", get_y2, set_y2);
addProperty ("_xscale2", get_xscale2, set_xscale2);
addProperty ("_yscale2", get_yscale2, set_yscale2);
addProperty ("_rotation2", get_rotation2, set_rotation2);
addProperty ("_xmouse2", get_xmouse2, null);
addProperty ("_ymouse2", get_ymouse2, null);
}
ASSetPropFlags (MCP, null, 1);
delete MCP;
////////////////////////////////////////////
To use this, first set your registration point like so:
mc._xreg = 100;
mc._yreg = 70;
Then you can rotate around this point by changing the _rotation2 property:
mc._rotation2 = 60;