Resize container when resizing application window in Adobe Flex / AIR application

I am working on an Adobe AIR application. The application window is 800X600 in size and contains a border container, and the border container contains many controls. I want the user to resize the application, then this container must also be scaled. ie If the user maximizes or minimizes the window, then this border container should also be maximized or minimized, respectively. Please help me as soon as possible. Thanks in advance.

+3
source share
3 answers

If you don't want (or can't for some reason) use percent width, then you can always just do the following in MXML:

<s:BorderContainer 
    xmlns:mx = "http://www.adobe.com/2006/mxml"
    xmlns:s = "library://ns.adobe.com/flex/spark"

    width = "{parentApplication.width / 2}"
    height = "{parentApplication.height / 2}">

You simply get a reference to the parentApplication component and directly bind to its width and height. Throw any math you want at the end.

+5
source

An easier way to do this is for your components to declare their sizes / positions relative to their external containers. For example, instead of setting x, y, width and height, set left, right, top and bottom in the Application component, as well as in the containers of your application. If you want to provide a minimum size of 800x600, you can set the minWidth and minHeight properties. Hope this helps.

+2
source

MVC. RobotLegs, Mate, Cairngorm .

, Application Event.RESIZE . stageHeight stageWidth .

, , .

+1

Source: https://habr.com/ru/post/1796303/


All Articles