Here's how I do it: function maintainAspect ( mc:MovieClip, maxW:Number, maxH:Number ) :Void { mc._width = maxW; mc._height = maxH; mc._xscale = mc._yscale = Math.min( mc._xscale, mc._yscale ); }
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Guilherme Cruz Sent: 26 March 2007 18:15 To: flashcoders@chattyfig.figleaf.com Subject: Re: [Flashcoders] Image resizer that maintains ratio The "_scale" property is a percentage value if you have a 800x600 image and set _xscale=50 and _yscale=50, you get a 400x300 image On 3/26/07, Hans Wichman < [EMAIL PROTECTED]> wrote: > > Hi, > that IS weird, because if your image is 800x600, you are saying: > target_mc._xscale = target_mc._yscale = 800; > > which is probably not what you want^^ > > greetz > JC > > > On 3/26/07, eric e. dolecki <[EMAIL PROTECTED]> wrote: > > > > Ok that is SO weird. I was just thinking about this... > > > > myListener.onLoadInit = function( target_mc:MovieClip ):Void { > > target_mc._xscale = target_mc._yscale = Math.max( > > target_mc._width, target_mc._height ); }; > > > > - Eric > > > > > > On 3/26/07, Adrian Lynch <[EMAIL PROTECTED]> wrote: > > > > > > Any examples out there? > > > > > > I've got as far as resizing a user supplied image and am about to > > > work > > on > > > the ratio remaining fixed. Just thought I'd throw this out there > > > as I think it may be tricky. > > > > > > Ta. > > > > > > Adrian > > > > > > _______________________________________________ > > > Flashcoders@chattyfig.figleaf.com > > > 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 > > > > > > > > > > > -- > > eric e. dolecki > > senior interactive engineer > > http://www.ericd.net > > _______________________________________________ > > Flashcoders@chattyfig.figleaf.com > > 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 > > > _______________________________________________ > Flashcoders@chattyfig.figleaf.com > 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 > _______________________________________________ Flashcoders@chattyfig.figleaf.com 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 _______________________________________________ Flashcoders@chattyfig.figleaf.com 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