Groups | Blog | Home
all groups > flash (macromedia) > november 2003 >

flash (macromedia) : Flash 6 registration point help


Luka
11/16/2003 8:37:24 PM
I know how to manualy change the position of registration point in flash 5
because there is that option under "transform", but i can't find that option
in flash 6. Please help ;) cuz i now it's something realy stupid...

urami_
11/17/2003 12:21:51 PM

[quoted text, click to view]

Free Transform Tool (Q key) , you will see the center point , just drag it away.
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.




Regards

urami_*



<lsym>

There's no place like 127.0.0.1

urami_
11/17/2003 12:27:57 PM


[quoted text, click to view]



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;

Jeckyl
11/17/2003 3:23:32 PM
[quoted text, click to view]

Do tell .. sounds interesting.

Jeckyl
11/17/2003 3:31:39 PM
aha .. thanks !!

basically, you add your own _xscale etc properties that use a script-defined
centre point. So for it to work, you need to ensure that other code uses
these new properties/methods.

[quoted text, click to view]
reg point, and _xscale2 and _yscale2 scale it.

AddThis Social Bookmark Button