Hi Jon,
i did something similar a while back, with the content of a scrollpane.
It was something like this:

//get the original x and y centre before scaling
var orgX = (((pane.width-16)/2)+pane.hPosition)/(pane.content._xscale/100);
var orgY = (((pane.height-16)/2)+pane.vPosition)/(pane.content._yscale/100
);

//change the scaling
var lastscale = pane.content._xscale;
pane.content._xscale = pane.content._yscale = scale;
pane.redraw(true);

//now use the formulas the other way around to get the new h and v position
for the pane
pane.hPosition = (orgX * (pane.content._xscale/100) - ((pane.width-16)/2));
pane.vPosition = (orgY * (pane.content._yscale/100) - ((pane.height-16
)/2));

I think the -16 was to compensate for the width of the scrollbar, but can't
tell for sure lo, was rewriting someone elses stuff at the time under
pressure:).

hth
JC



On 11/8/06, Jon Bennett <[EMAIL PROTECTED]> wrote:

> The math for this is luckily just algebra and doesn't require any
> complex trig or calculus, and there are a few different ways to do it.
> This might help you on your way:
>
> http://www.darronschall.com/weblog/archives/000054.cfm

looks perfect, thanks!

jon

--


jon bennett
t: +44 (0) 1225 341 039 w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to