0

I want to be able to resize my application (which is on by default, by dragging a corner of the app to resize the whole window). However, I'd like to lock the aspect ratio of this, so that when I resize, the main window will keep the original aspect ratio.

How do I do this?

I'm using FlashBuilder 4.6.

bcsb1001
  • 2,834
  • 3
  • 24
  • 35
Stian Berg Larsen
  • 543
  • 2
  • 10
  • 29

1 Answers1

0

As far as I know there is not an easy way to do this, as there is no simple way to determine when the resize event is done. If you try to keep the aspect ratio the same using the ResizeEvent, you get this annoying flicker and it doesn't work very well otherwise either.

My solution would be either doing a custom resize button/slider that proportionally increases both width and height according to the aspect ratio, or maybe looking into StageScaleModes, keeping the Scale as edit:SHOW_ALL while only scaling the background image for example.

Pete TNT
  • 8,293
  • 4
  • 36
  • 45
  • I was hoping there where a simple function like scaleMode="letterbox" or something like that. I've seen other apps that scale like I want to. I'll wait and see if anyone else have any good ideas, otherwise I'll try your solution – Stian Berg Larsen May 14 '13 at 10:46
  • Edited my original response a bit, as I used the wrong constant. With StageScaleMode.SHOW_ALL, it does the following: _Specifies that the entire application be visible in the specified area without distortion while maintaining the original aspect ratio of the application. Borders can appear on two sides of the application._, which means pretty much letterboxing, if your application is in 16/9 aspect ratio or similar. But that still leaves the empty space around the insides of the window chrome, so you need to set contentBackgroundColor for your s:WindowedApplication to black. – Pete TNT May 14 '13 at 11:50