I've been using a textArea component which I am dragging around the stage. The default position for the registrationpoint seems to be in the top left. I would like to change this position to the centre. Is there any actionScript code I can use to do this? I have named my components: text1, text2, etc.
Geezer is wrong. It is possible to move the registrationpoint with actionscript, which I have used in a map programme that zooms in-out from the screens centre.
So, you can dynamically scale and/rotate an mc and move the reg point to the center using AS.
See example attached. Att: there 3 AS 1. in the circle, in the button, in the first frame.
Good luck!
Q:Is there any actionScript code I can use to do this?
A:I don't think it's possible. You might be able to put the component inside a movie clip and move the clip.(not with AS?)
Dear Geezer if you think I have something personal against you, you will be wrong for the third time. If you have something personal against me, I shall never post an answer under your posts. If none of the above is true, I shall remove this post and any statement that could be consindered as an inuendo from you.
After all there is nothing more than sharing knowledge and experience, with some humour sometimes
So, you can dynamically scale and/rotate an mc and move the reg point to the center using AS.
what if you want to move the registrationpoint to a point that is NOT the center?
i've got a map that sits beneath a mask. when the user clicks a point on the map, four things happen:
1. the map scales from 100% to 200%
2. the map itself moves beneath the mask so that the point that was clicked remains where it was prior to the zoom (when the map scales 200%, the point obviously moves, so this step compensates for that move)
3. the mask scales from 100% to 25%
4. the mask moves so that it frames the point that was clicked.
the overall effect of these four steps is a kind of zoom-in focus effect. the user clicks on a point, and that point is zoomed in and framed nicely.
the problem is that all of the above-mentioned moves and scales use onEnterFrame, and the effect is smooth but not perfect.
if there was a way to modify the actual registrationpoint, then steps 1 and 2 could be consolidated, as could 3 and 4. i'm scaling AND moving because the registrationpoint is someplace other than the place that was clicked. if i could move the registrationpoint to the point that is clicked, then scale alone, without the move, would suffice, and the overall effect would be more convincing.
anyway, if anyone knows how to do this, please let me know!
Try to play with the code that I uploaded.
The button has the following code:
on (press) {
z+=10
r+=10//this is for the rotation, so you can remove it
x=_root.regx//here is the x for the registration you can change it to whatever disired
y=_root.regy//here is the y for the registration
map.Zoom(z, r, x, y);
}
So, now that you know how to move the reg point, use some maths to move it to the place you want.
I have done a map project myself with only difference that the map would always zoom in and out with its reg point in the center of the mask.
Good luck.
i modified your script and it works nicely, although i had to specify a fixed offset on the y coordinate. in any case, no big deal.
i couldn't get it to work with AS-based onEnterFrame-driven moves and scales though. in any case, if i have some time, i'll try to sort that out, but i suspect i'll run into similar problems i was having with my previous solution (which, by the way, does work.... it's just that at the very end of the move/scale it jitters slightly).