Edit/Move Registration Point with AS?

Is it possible with ActionScript to move a MovieClip’s registration point? I’m having issues with scaling an object (via actionscript) from different points (left side, right side, centre) and getting round off error.

Without moving the registration point, I need to fake the scaling to make it look like it’s scaling from the right or centre. (registration point is at the left) I do this by scaling it then using some trig move its _x, _y coordinates depending on it’s _rotation. Unfortunately, this is producing some very small roundoff error that propogates slowly but surely, upwards of 1 to 10 or more pixels. As it’s a pseudo-ACAD application I can’t really have that. I also tried using the localToGlobal and globalToLocal functions with the same results.

However, if I don’t need the _x,_y transformations (the registration point is in the correct spot for the particular scale) then the round off error no longer applies.

So yeah, I looked around a bit but couldn’t find anything for doing this in ActionScript. (mostly tutorials on how to move the registration point by converting to a symbol or free transform tool) Any help would be awesome. =]

I hate shameless self-bumps, but I’d really appreciate an answer on this. All the junk aside in that post, all I need to know is if I can edit the registration point location via actionscript. A simple ‘no’ will suffice if it’s not possible. Thanks. =]

NO :wink:

But there is allways a solution =)

If you cant move the registration point itself, move the object and its content… it will produce the same effect. Example… You have a MC (200 x 200 px) with its registeration point at 0x0 if that MC… the content of that MC is wrapped in another movieclip. Now if you want to move registeration point to the right-top corner, you will move content by x:-200, y:0 relatively and the MC itself by x:+200 y:0 also relatively. If you want some function for this, it could look like this:

function moveRegisterationPoint(x:Number,y:Number,target:MovieClip):Void {
    // move the target MC
    target._x += x;
    target._y += y;
    // assuming that target MC has "content" MC inside
    target.content._x -= x;
    target.content._y -= y;
}
// moves registeration point of someMC
// by 200px to the right and 100px to the top
moveRegisterationPoint(200, -100, someMC);

Not a bad idea. I will have to test this. I know such a thing is going to make my code a tad more complicated, but if it can do the job, then great! I’ll see how it works; hopefully when I move the registration point I don’t get round-off error (as I’m moving on angles with trig). If I remember I’ll let you know if it was successful; thanks!