Here is the method I use, It works for simply rescaling, or conditional rescaling (i.e. if(object._width > yourMaxWidth){ rescaleDimensions();};
function rescaleDimensions(){ oldWidth = object._width; oldHeight = object._height; object._width = yourNewWidth; object._height = ((yourNewWidth*oldHeight)/oldWidth); //thats it. Simple. } Heres the algebra: x/y = new x/ new y therefore x*new y = y* new x therefore new y = (y * new x)/x Note: I didn't read the original post, just answering according to the subject title. Hope I was of some help. (becasue I have gotten losts of it along the way too) Paul Vdst. ----- Original Message ----- From: "Steven Sacks | BLITZ" <[EMAIL PROTECTED]> To: <flashcoders@chattyfig.figleaf.com> Sent: Thursday, March 29, 2007 1:24 PM Subject: RE: [Flashcoders] Scaling Up an Image in Proportion to width or height Why would you do that, though? You're adding an extra calculation for no reason. It's inefficient and unnecessary. And I'm not setting _height to _width divided by ratio, but _width TIMES ratio. > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf > Of Steve Abaffy > Sent: Thursday, March 29, 2007 11:46 AM > To: flashcoders@chattyfig.figleaf.com > Subject: RE: [Flashcoders] Scaling Up an Image in Proportion > to width or height > > Yes but you could do it like this > > You resize the _width: > _width = Math.max(newWidth, 500); > You set _height to the _width * ratio: > _height = _width * (1/ratio); > Which is the same thing as > _height = _width / ratio; > > > > This would be (_width/_height * _height) this cancels the > _height leaving > you with just _width. > > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf > Of Hershell > Bryant > Sent: Thursday, March 29, 2007 1:58 PM > To: flashcoders@chattyfig.figleaf.com > Subject: RE: [Flashcoders] Scaling Up an Image in Proportion > to width or > height > > That'd do it...except that you need to define var ratio:Number = > _height/_width. > > If var ratio:Number = _width/_height, then _width * ratio = (_width * > _width)/_height....That ain't right. > > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf > Of Steven Sacks > | BLITZ > Sent: Thursday, March 29, 2007 9:42 AM > To: flashcoders@chattyfig.figleaf.com > Subject: RE: [Flashcoders] Scaling Up an Image in Proportion > to width or > height > > Simple. > > You solve for the ratio: > > var ratio:Number = _width / _height; > > > You resize the _width: > > _width = Math.max(newWidth, 500); > > > You set _height to the _width * ratio: > > _height = _width * ratio; > > > fin. > _______________________________________________ > 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 _______________________________________________ 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