Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>When creating the layout in your flex application, you can achieve a consistent <em>screen resolution</em> independent look and feel from using <strong>relative scaling</strong>.</p> <p>This is much akin to creating a <em>liquid</em> layout with HTML.</p> <p>For example, to create a simple two column application— left navigation and content— you only need two containers, one predefined and one left to scale indefinitely.</p> <p>As follows:</p> <pre><code>&lt;mx:HBox width="225"&gt; &lt;mx:Button label="Menu 1"/&gt; &lt;mx:Button label="Menu 2"/&gt; &lt;mx:Button label="Menu 3"/&gt; &lt;/mx:HBox&gt; &lt;mx:HBox width="100%"&gt; Any content here will flow fluidly across the entire screen regardless of window size/screen resolution. &lt;/mx:HBox&gt; </code></pre> <p>Using the above basics you can create a application layout that forms to any screen.</p> <hr> <p><em>However</em>, sometimes you need to create a more elaborate layout scheme with many interchanging components resizing dynamically to fit the window.</p> <p>For this you can do <strong>Absolute Positioning</strong>. override the components updateDisplayList() function and create your own sizing/positioning rules.</p> <p>This of course requires you to be within a Canvas container or have the main Application container set to <em>absolute</em> layout.</p> <p>A simple example:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"&gt; &lt;mx:Script&gt; override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number) : void { //find out how big we are var stageWidth:int = this.width; //center the box in the middle of the page. centeredBox.x = stageWidth - (centeredBox/2); } &lt;/mx:Script&gt; &lt;mx:HBox id="centeredBox" width="500"/&gt; &lt;/mx:Application&gt; </code></pre> <p>By overriding updateDisplayList() you can create endless ways to better dynamically position and size your components to better use the screen realestate.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload