I am using flex and actionscript to create a photog site and I want the background to display an image that completely covers the background without distortion. I have tried just an image tag and assigned width and height to 100% but the problem comes in when teh display has a wider aspect than the photo. As a result, the height is scaled 100% and the width is something less. I would rather have it scale to whichever is larger, ie if the window is too wide, scale the photo to 100% width and let the excess go off the screen. That way, the photo will always cover the screen and there won't be any distractrating background color showing.
I was planning on using actionscript to report the width and height of the image so that I can compare it to the window width and height but it appears that you can not get the photo dimensions. I can use application.width and application.height but I need some way to compare that to the photo. Also, is there an eventlistener that I should use to monitor when the user resizes the window or will the image scaling be done automatically?
Thanks for any comments,
Would Eli's SuperImage help? I know it's smarter about resizing while maintaining aspect ratio:
Application container inherits "resize" event from UIComponent.
Application.application.width will give you the size of the app in the browser window.
img1.width = Application.application.width;
The resize event worked perfectly. Thanks for the help.