PDA

View Full Version : Resize Air app without stretching?


pixielex
04-26-2008, 05:07 PM
Is it possible to make an Air app resizable without stretching all of the content? I am building an application where the user loads an image into the app window. If, for example, the user loads an image that is larger than the window size, I would like them to be able to resize the window to fit the image -- i.e. it's important that the image retain its original dimensions and NOT stretch. Similar to what happens if you have an image open in photoshop and you resize the window. Is this possible?

kdittyr
04-26-2008, 09:23 PM
I imagine that it is possible, but I haven't thought of just how to do it, yet :)

evride
04-27-2008, 08:14 AM
yes. add this line:


stage.scaleMode = StageScaleMode.NO_SCALE;


this also allows you to use the Event.RESIZE event. also, if you choose to use custom chrome it automatically disables scale mode.


and wonderful help there kdittyr

pixielex
04-28-2008, 03:03 PM
Thanks evdog! That works...except, when I load an image that's larger than the window and then resize to try to fit the whole image, the image keeps getting moved so that I can never see all of it. Hard to explain, but basically, when I load the image, it loads at the top left (0,0), but when I stretch the window, I keep getting more and more white space to the top and left of the image. Any idea why this is happening and how to fix it?

pixielex
04-28-2008, 03:08 PM
Never mind, I figured it out! It just involved adding this line:

stage.align = StageAlign.TOP_LEFT;