Search code examples
airwindowadobeautoresize

Auto-resize content of a new AIR Window


AIR's spark.components.WindowedApplication would resize its contents automatically as I manually stretch window bounds or maximize/restore it. But spark.components.Window class does not provide such functionality 'out of the box': the contents of the Window don't change their size as I stretch/maximize/restore the window, when the corresponding spark.components.Window.nativeWindow instance does resize its bounds. My AIR application is required to open multiple windows, and resizable ones. How can I make them automatically resize their contents to match the nativeWindow bounds?


Solution

  • Assuming you mean the spark.components.Window, this is based on the skinnablecontainer so there shouldn't be anything preventing you from using a percentbased layout / constraint.

    <s:Window xmlns:fx="http://ns.adobe.com/mxml/2009" 
              xmlns:s="library://ns.adobe.com/flex/spark" 
              xmlns:mx="library://ns.adobe.com/flex/mx" 
              width="100%" height="100%">
    

    Other methods for manually handling this sort of thing include listening for the ResizeEvent coming from the stage.