[_] Maths: scale one mc, whilst keeping an mc within it the same size
Jan Grant
jan.grant at bristol.ac.uk
Wed Nov 1 22:23:08 GMT 2006
On Wed, 1 Nov 2006, Jon Bennett wrote:
> hi,
>
> I'm scaling a large-ish MovieClip to specific width/height
> combinations. Within this MovieClip I have numerous link MCs, which I
> want to keep at 100%, regardless of their containing MovieClip's
> width/height, and the maths involved has me a little stumped!
>
> some example code:
>
> // attach map symbol from the stage (_width: 744 _height: 445)
> var mcMap:MovieClip = this.attachMovie ('map', 'map', 20);
>
> // attach link within mcMap (_width: 140 _height: 21)
> var mcLink:MovieClip = mcMap.attachMovie ('link', 'link'+1, 200);
>
> // example function
> _root.onPress = function ()
> {
> mcMap._width = 2710;
> mcMap._height = 1620;
>
> mcLink._xscale = mcLink._yscale = ARRGGHH!
> }
>
> I need a formular to obtain the scale to set to the the link MC so it
> stays it's original size, but I'm stumped as to what it is, anyone got
> any ideas?
In the case above: for the x-dimension, the original host clip was 744
wide; it becomes 2710 wide. It's scaled up by a factor of 2710/744. So I
guess that you want to scale the smaller clip in the opposite direction,
ie, by a factor of 744/2710. Similarly for the y scale.
jan
--
jan grant, ISYS, University of Bristol. http://www.bris.ac.uk/
Tel +44 (0)117 3317661 http://ioctl.org/jan/
Usenet: The separation of content AND presentation - simultaneously.
> hi,
>
> I'm scaling a large-ish MovieClip to specific width/height
> combinations. Within this MovieClip I have numerous link MCs, which I
> want to keep at 100%, regardless of their containing MovieClip's
> width/height, and the maths involved has me a little stumped!
>
> some example code:
>
> // attach map symbol from the stage (_width: 744 _height: 445)
> var mcMap:MovieClip = this.attachMovie ('map', 'map', 20);
>
> // attach link within mcMap (_width: 140 _height: 21)
> var mcLink:MovieClip = mcMap.attachMovie ('link', 'link'+1, 200);
>
> // example function
> _root.onPress = function ()
> {
> mcMap._width = 2710;
> mcMap._height = 1620;
>
> mcLink._xscale = mcLink._yscale = ARRGGHH!
> }
>
> I need a formular to obtain the scale to set to the the link MC so it
> stays it's original size, but I'm stumped as to what it is, anyone got
> any ideas?
In the case above: for the x-dimension, the original host clip was 744
wide; it becomes 2710 wide. It's scaled up by a factor of 2710/744. So I
guess that you want to scale the smaller clip in the opposite direction,
ie, by a factor of 744/2710. Similarly for the y scale.
jan
--
jan grant, ISYS, University of Bristol. http://www.bris.ac.uk/
Tel +44 (0)117 3317661 http://ioctl.org/jan/
Usenet: The separation of content AND presentation - simultaneously.