Thanks for your help, but I think doing my own scaling is easier:

if (image.width > Application.application.width)
{
  image.width   = Application.application.width;
  image.height  = Math.round((image.width / origWidth) * origHeight);
}

-radley



On Jul 7, 2008, at 4:27 PM, Josh McDonald wrote:

The width and height is part of the Flex Image component, whereas the scalex is part of Flash's internal stuff for everything. You could subclass Image and add other child components because it extends UIComponent, and then when you set width and height the Image component would scale the image, but your other children would not (automatically at least). But if you achieve the size change using scaleX, the entire thing would scale.

Hope that clears it up :)

-Josh


On Tue, Jul 8, 2008 at 9:23 AM, Radley <[EMAIL PROTECTED]> wrote:


If change the width of a flex Image component, the scaleX remains 1:

(image starting size: 1920x1200)


CODE:

if (image.width > Application.application.width)
{
  trace("\rimage.scaleX = " + image.scaleX);
  trace("image.width = " + image.width);

  image.width = Application.application.width;

  trace("\rimage.scaleX = " + image.scaleX);
  trace("image.width = " + image.width);

  image.scaleY          = image.scaleX;
}

trace("\rimage.scaleX = " + image.scaleX);
trace("image.scaleY = " + image.scaleY);
trace("image: (" + image.width+ ", " +image.height+ ")");


RESULT:

image.scaleX = 1
image.width = 1920

image.scaleX = 1
image.width = 1025

image.scaleX = 1
image.scaleY = 1
image: (1025, 1200)


Is the Image component missing scaleX & scaleY properties? Or is there
some special event that has to happen for scale to recognize a change
in width/height???


thnx


-radley



------------------------------------------------------------------------------
Radley Marx
www.radleymarx.com
[EMAIL PROTECTED]
------------------------------------------------------------------------------





------------------------------------

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo ! Groups Links






--
"Therefore, send not to know For whom the bell tolls. It tolls for thee."

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]



Reply via email to