RE: [Flashcoders] Image resizer that maintains ratio

2007-03-28 Thread Joe Wheeler
bject: RE: [Flashcoders] Image resizer that maintains ratio mc._width = maxW; mc._height = maxH; (mc._xscale > mc._yscale) ? mc._xscale = mc._yscale : mc._yscale = mc._xscale; > You could probably optimize a little bit by removing the Math > function... > > mc._width = maxW;

RE: [Flashcoders] Image resizer that maintains ratio

2007-03-28 Thread Steven Sacks | BLITZ
mc._width = maxW; mc._height = maxH; (mc._xscale > mc._yscale) ? mc._xscale = mc._yscale : mc._yscale = mc._xscale; > You could probably optimize a little bit by removing the Math > function... > > mc._width = maxW; > mc._height = maxH; > if ( mc._xscale > mc._yscale ) { > mc._xscale

RE: [Flashcoders] Image resizer that maintains ratio

2007-03-28 Thread Joe Wheeler
. Anyone? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Hans Wichman Sent: 27 March 2007 16:06 To: flashcoders@chattyfig.figleaf.com Subject: Re: [Flashcoders] Image resizer that maintains ratio ok, thanks joe for the explanation. Seems a lot of static / redun

Re: [Flashcoders] Image resizer that maintains ratio

2007-03-27 Thread Hans Wichman
a long time before showing up. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Hans Wichman Sent: 27 March 2007 08:23 To: flashcoders@chattyfig.figleaf.com Subject: Re: [Flashcoders] Image resizer that maintains ratio The more I read these post, the mo

RE: [Flashcoders] Image resizer that maintains ratio

2007-03-27 Thread Joe Wheeler
oders@chattyfig.figleaf.com Subject: Re: [Flashcoders] Image resizer that maintains ratio The more I read these post, the more I wonder whether people actually read what others have already replied. On 3/26/07, Joe Wheeler <[EMAIL PROTECTED]> wrote: > > Here's how I do it: >

Re: [Flashcoders] Image resizer that maintains ratio

2007-03-26 Thread Hans Wichman
; 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] Im

RE: [Flashcoders] Image resizer that maintains ratio

2007-03-26 Thread Joe Wheeler
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

Re: [Flashcoders] Image resizer that maintains ratio

2007-03-26 Thread Guilherme Cruz
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._yscal

RE: [Flashcoders] Image resizer that maintains ratio

2007-03-26 Thread Adrian Lynch
Ah nice one Jack. That's just what I was looking for. Will let you know how I get on. Adrian -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Jack Doyle Sent: 26 March 2007 15:59 To: flashcoders@chattyfig.figleaf.com Subject: RE: [Flashcoders] Image re

Re: [Flashcoders] Image resizer that maintains ratio

2007-03-26 Thread Andreas R
My scaleToFit function. Probably not the most awesome thing, but it does the job private function scaleToFit(target:Object,clipRect:Rectangle,maintainAspect:Boolean){ var w:Number = clipRect.width; var h:Number = clipRect.height; var ratio:Number; var scalew:Number;

RE: [Flashcoders] Image resizer that maintains ratio

2007-03-26 Thread Jack Doyle
This might be overkill, but feel free to use the TransformManager and/or TransformItem class(es) available at http://www.greensock.com/ActionScript/TransformManager. You can just set the constrainScale_boolean property to true. Jack Doyle -Original Message- Date: Mon, 26 Mar 2007 13:08:

RE: [Flashcoders] Image resizer that maintains ratio

2007-03-26 Thread Adrian Lynch
f Of Danny Kodicek Sent: 26 March 2007 14:03 To: flashcoders@chattyfig.figleaf.com Subject: RE: [Flashcoders] Image resizer that maintains ratio > 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 t

Re: [Flashcoders] Image resizer that maintains ratio

2007-03-26 Thread Hans Wichman
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.onLoad

Re: [Flashcoders] Image resizer that maintains ratio

2007-03-26 Thread Guilherme Cruz
Ops.. //store original sizes originalWidth = myImage._width; originalHeight = myImage._height; //get the ratio finalRatio = originalWidth/500; myImage._width = originalWidth * finalRatio; myImage._height = originalHeight * finalRatio; ___ Flashcoders@c

Re: [Flashcoders] Image resizer that maintains ratio

2007-03-26 Thread Guilherme Cruz
eg. if your original image size is 800x600 and you want it to be 500 x ? : (pseudo code) //store original sizes originalWidth = myImage._width; originalHeight = myImage._width; //get the ratio finalRatio = originalWidth/500; myImage._width = originalWidth * finalRatio; myImage._height = origina

RE: [Flashcoders] Image resizer that maintains ratio

2007-03-26 Thread Danny Kodicek
> 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. How are they resizing? Which bit is tricky? Maintaining an aspect ratio isn't too hard - you

Re: [Flashcoders] Image resizer that maintains ratio

2007-03-26 Thread eric e. dolecki
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 the