<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>Life on Rails - Home</title>
  <id>tag:lifeonrails.org,2009:mephisto/</id>
  <generator version="0.7.3" uri="http://mephistoblog.com">Mephisto Noh-Varr</generator>
  <link href="http://lifeonrails.org/feed/atom.xml" rel="self" type="application/atom+xml"/>
  <link href="http://lifeonrails.org/" rel="alternate" type="text/html"/>
  <updated>2009-06-22T22:09:10Z</updated>
  <entry xml:base="http://lifeonrails.org/">
    <author>
      <name>georgejcook</name>
    </author>
    <id>tag:lifeonrails.org,2009-06-22:18920</id>
    <published>2009-06-22T22:01:00Z</published>
    <updated>2009-06-22T22:09:10Z</updated>
    <category term="flex"/>
    <category term="ant"/>
    <category term="ant tasks"/>
    <category term="flex"/>
    <category term="flexunit"/>
    <category term="FlexUnit"/>
    <category term="headless"/>
    <category term="linux"/>
    <link href="http://lifeonrails.org/2009/6/22/running-flexunit-ant-task-on-headless-linux" rel="alternate" type="text/html"/>
    <title>Running flexunit ant task on headless linux</title>
<content type="html">
            &lt;p&gt;I've had endless trouble with this. As it goes, I don't much like Ant, I'd rather use maven, but flashbuilder is nowhere near up to scratch with m2elipse right now. As such, I'm stuck with ant and flexunit ant tasks..&lt;/p&gt;

&lt;p&gt;I've wasted hours trying to get this going on headless linux, but finally the answer became clear. A friend of mine pointed out that peter Ent's flexunit task makes a call to gflashplayer instead of flashplayer. So I do the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;create  bash script called gflashplayer with this command:xvfb-run flashplayer $1,&lt;/li&gt;
&lt;li&gt;ensure that the swf you are executing is stored in a trusfile. I have an ant task that adds the swf to the file antUnitTests.cfg stored in: ~/.macromedia/Flash_Player#Security/FlashPlayerTrust/&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I also turn on logging by having an ~/mm.cfg file with the contents:
ErrorReportingEnable=1
TraceOutputFileEnable=1&lt;/p&gt;

&lt;p&gt;This helps, as you can trace -f the log file generated at ~/.macromedia/Flash_Player/Logs/flashlog.txt&lt;/p&gt;

&lt;p&gt;I'm so glad to finally have this resolved. I hope this helps you get flexunit integrated with ant on hudson, teamcity or whatever other ci you have on headless linux too!&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://lifeonrails.org/">
    <author>
      <name>georgejcook</name>
    </author>
    <id>tag:lifeonrails.org,2009-06-22:18919</id>
    <published>2009-06-22T21:55:00Z</published>
    <updated>2009-06-22T22:12:54Z</updated>
    <category term="flex"/>
    <category term="actionscript"/>
    <category term="flex"/>
    <category term="formatting"/>
    <link href="http://lifeonrails.org/2009/6/22/code-formatting-in-flashbuilder" rel="alternate" type="text/html"/>
    <title>Code formatting in Flashbuilder</title>
<content type="html">
            &lt;p&gt;Got the flashbuilder 4?&lt;/p&gt;

&lt;p&gt;It&#8217;s really much better than flexbuilder, I suggest you download it straight away!&lt;/p&gt;

&lt;p&gt;Anyhow, that&#8217;s not why I&#8217;m writing. The reason is that there&#8217;s a great code formatting plugin I&#8217;ve discovered for automatically formatting mxml and actionscript code.&lt;/p&gt;

&lt;p&gt;It&#8217;s great!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;flexible - you can configure it yourself,&lt;/li&gt;
&lt;li&gt;powerful - works for as and mxml,&lt;/li&gt;
&lt;li&gt;quick,&lt;/li&gt;
&lt;li&gt;has extra benefits, like gives you quick headsup if you have silly errors, without having to spend a compile cycle,&lt;/li&gt;
&lt;li&gt;can share the settings with your team (via import/export) which makes it really easy to enforce coding standards,&lt;/li&gt;
&lt;li&gt;saves loads of time - just click a button before submitting your file!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Loving it! the plugin is named flexformatter and is availabe here: &lt;a href=&quot;http://sourceforge.net/projects/flexformatter/&quot;&gt;http://sourceforge.net/projects/flexformatter/!&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;DONT DELAY - download it!!&lt;/p&gt;

&lt;p&gt;Install instructions are on the link, it&#8217;s real easy to install..&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://lifeonrails.org/">
    <author>
      <name>georgejcook</name>
    </author>
    <id>tag:lifeonrails.org,2009-06-22:18921</id>
    <published>2009-06-22T21:47:00Z</published>
    <updated>2009-06-22T22:58:23Z</updated>
    <category term="ant"/>
    <category term="flex"/>
    <category term="Java"/>
    <category term="java"/>
    <link href="http://lifeonrails.org/2009/6/22/making-ant-nicer" rel="alternate" type="text/html"/>
    <title>making ant nicer</title>
<content type="html">
            &lt;p&gt;As I said in my previous post, ant get&#8217;s my goat..&lt;/p&gt;

&lt;p&gt;the ant-contribe project makes it easier to live with by adding a whole suite of tasks that make it more bearable by adding common coding constructs, like foreach, if, trycatch and MUTABLE VARIABLES! (discouraged, I know, but useful sometimes ;) ).&lt;/p&gt;

&lt;p&gt;FInd it here:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://ant-contrib.sourceforge.net/tasks/index.html#install&quot;&gt;http://ant-contrib.sourceforge.net/tasks/index.html#install!&lt;/a&gt;&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://lifeonrails.org/">
    <author>
      <name>georgejcook</name>
    </author>
    <id>tag:lifeonrails.org,2009-03-22:15345</id>
    <published>2009-03-22T22:11:00Z</published>
    <updated>2009-03-22T22:18:23Z</updated>
    <category term="java"/>
    <category term="certification"/>
    <category term="exam"/>
    <category term="Java"/>
    <category term="java"/>
    <category term="SCJP 6"/>
    <link href="http://lifeonrails.org/2009/3/22/passed-java-scjp-6" rel="alternate" type="text/html"/>
    <title>Passed Java scjp 6</title>
<content type="html">
            &lt;p&gt;So chuffed!&lt;/p&gt;

&lt;p&gt;Passed the scjp 6 exam with 77% !&lt;/p&gt;

&lt;p&gt;Did it mainly so I could get my Java up to speed and hit the ground running with Blaze ds, Livecycle or other Java backend's sitting behind Flex, as I envisage it will be very useful to me in the future.&lt;/p&gt;

&lt;p&gt;The exam is REALLY HARD. The questions are so sneaky! I had to do quite a bit of learning for this, as I haven't learned any new java since java 3. I had to learn all of the new generics, collections and enums too! In fact, asserts as well!&lt;/p&gt;

&lt;p&gt;It's a great way to focus your learning though - I'm not going to pretend I know dick about Java in the workplace, because I would need some proper exposure before making claims, but that's not the point: The point is that I can now pick up Java without having to worry about the basics, I'll be able to spend my time learning the api's of the technology I'm using rather than spend it learning Java syntax and concepts.&lt;/p&gt;

&lt;p&gt;Was very insightful too - also made me realise just how horribly lacking actionscript is! Still, as has some lovely rough and ready elements to it that retain its' charm :)&lt;/p&gt;

&lt;p&gt;So, yeah - if you're thinking of doing it and you're not a full time Java bod, expect to revise real hard!&lt;/p&gt;

&lt;p&gt;Next up is the flash exam - that one should be a walk in the park compared to Java :D&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://lifeonrails.org/">
    <author>
      <name>georgejcook</name>
    </author>
    <id>tag:lifeonrails.org,2009-03-02:13908</id>
    <published>2009-03-02T22:32:00Z</published>
    <updated>2009-03-02T22:38:32Z</updated>
    <category term="flex"/>
    <link href="http://lifeonrails.org/2009/3/2/messing-about-with-components-inline-with-text" rel="alternate" type="text/html"/>
    <title>messing about with components inline with text</title>
<content type="html">
            &lt;p&gt;This is more a note to myself,&lt;/p&gt;

&lt;p&gt;I've got my smiley textarea, but I'm going to rewrite the whole thing from scratch. &lt;/p&gt;

&lt;p&gt;Before I do, heres some code I need in the office tomorrow! Might be of use to you too..&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;

&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&amp;lt;mx:application&gt;
    &amp;lt;mx:script&gt;
        &amp;lt;![CDATA[
            import mx.controls.TextInput;

        private function cc() : void
        {
            var ti : TextInput = new TextInput();
            ti.width = 100;
            ti.height=18;
            t.clip = ti;
            t.targetText = &quot;APPLE&quot;;
            t.text = &quot;here is an APPLE and some text to wrap around it, hopefully&quot; + 
                    &quot;it will be nice&quot;;
            t2.text = &quot;here is an APPLE and some text to wrap around it, hopefully &quot; + 
                    &quot;it will be nice&quot;;
            ti = new TextInput();
            ti.width = 100;
            ti.height=18;
            t3.clip = ti;
            t3.targetText = &quot;APPLE&quot;;  
            t3.text = &quot;APPLE is an and some text to wrap around it, hopefully &quot; + 
                    &quot;it will be nice&quot;;
            ti = new TextInput();
            ti.width = 100;
            ti.height=18;
            t4.clip = ti;
            t4.targetText = &quot;APPLE&quot;;
            t4.text = &quot;here is an and some text to wrap around it, hopefully &quot; + 
                    &quot;it APPLE be nice&quot;;
        }
        ]&gt;
    &amp;lt;/mx:script&gt;

    &amp;lt;local:supertext width=&quot;300&quot; /&gt;
    &amp;lt;local:supertext width=&quot;300&quot; /&gt;
    &amp;lt;local:supertext width=&quot;300&quot; /&gt;
    &amp;lt;local:supertext width=&quot;300&quot; /&gt;
&amp;lt;/mx:application&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;

package
{
    import flash.display.DisplayObject;
    import flash.text.TextField;
    import flash.text.TextLineMetrics;

    import mx.controls.Text;

    public class SuperText extends Text
    {
        public var targetText  : String = &quot;APPLE&quot;;
        private var measurer : TextField;
        private var space : int;
        private var targetTextWidth : int;
        private var lineHeight : int;

        public function SuperText() 
        {
            super();
        }

        override protected function createChildren() : void
        {
            super.createChildren();
            measurer = new TextField();
            measurer.visible = false;
            addChild( measurer );
            textField.text = &quot; &quot;;
            space = textField.textWidth;
            textField.text = targetText;
            targetTextWidth = textField.textWidth;
            lineHeight = textField.getLineMetrics( 0 ).height;
        }
        private var _clip : DisplayObject;
        private var clipChanged : Boolean;
        public function set clip  ( value : DisplayObject ) : void
        {
            _clip = value;
            clipChanged = true;
        }

        public function get clip() : DisplayObject
        {
            return _clip;
        }

        override protected function updateDisplayList(w:Number, h:Number):void
        {
            super.updateDisplayList( w, h );
            measurer.width = w;
            measurer.height = h;
        }

        override protected function commitProperties() : void
        {
            if ( clipChanged &amp;&amp; clip )
            {
                addChildAt( clip, numChildren );
                clipChanged = false;
            }
            super.commitProperties();
            updateTextLayout();
        }

        override public function set text(value : String ) : void
        {
            super.text = value;
            measurer.text = value;
        }

        private function updateTextLayout() : void
        {
            if ( !clip ) return;
            var i : int = text.indexOf( targetText );
            //calculate how many characters to replace
            var chars : int = clip.width / space;   
            textField.text = textField.text.replace( targetText, makeSpace( chars -1) );
            var l : int = textField.getLineIndexOfChar( i );
            var offset : int = textField.getLineOffset( l );
            var subText : String = textField.getLineText( l ).substr(0, (i +1) - offset );
            measurer.text = subText;
            var lm : TextLineMetrics = measurer.getLineMetrics( 0 );
            clip.x = lm.width;
            clip.y = lineHeight * l;
        }

        private function makeSpace( n : int ) : String 
        {
            var s : String =&quot;&quot;;
            for ( var i : int; i &amp;lt; n; i++ ) 
            {
                s+=&quot; &quot;;
            }
            return s;
        }

    }
}
&lt;/code&gt;&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://lifeonrails.org/">
    <author>
      <name>georgejcook</name>
    </author>
    <id>tag:lifeonrails.org,2009-02-22:13370</id>
    <published>2009-02-22T17:12:00Z</published>
    <updated>2009-02-22T19:08:43Z</updated>
    <category term="flex"/>
    <category term="me, a person"/>
    <category term="ace"/>
    <category term="adobe air"/>
    <category term="certification"/>
    <category term="flex"/>
    <link href="http://lifeonrails.org/2009/2/22/i-passed-my-adobe-flex-3-and-air-exam" rel="alternate" type="text/html"/>
    <title>I passed my Adobe Flex 3 and Air exam</title>
<content type="html">
            &lt;p&gt;&lt;img src=&quot;http://www.lifeonrails.org/images/articles/aceflexair.gif&quot; alt=&quot;Adobe Flex 3 Certified Expert&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://www.lifeonrails.org/images/articles/iamace.gif&quot; alt=&quot;Adobe Flex 3 Certified Expert&quot; /&gt;
:D&lt;/p&gt;

&lt;p&gt;Just a note to say I passed my flex 3 and adobe air exam. I got 90%, which is ok, but tbh, I thought I could've/shoud've got a hundred, the exam is actually quite easy, as it goes.&lt;/p&gt;

&lt;p&gt;I think the flex 2 exam is much, much harder, and I'll certainly be advising recruitment agents I know to look for candidates' with both, as I reckon the 3 certification is much more blaggable than the flex 2 certification (I don't think that was blaggable, actually).&lt;/p&gt;

&lt;p&gt;My score breakdown is as follows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Total 90%&lt;/li&gt;
&lt;li&gt;Creating a user interface     100%&lt;/li&gt;
&lt;li&gt;Flex system architecture     88%&lt;/li&gt;
&lt;li&gt;Programming flex applicaitons with actionscript 91%&lt;/li&gt;
&lt;li&gt;Interacting with data sources and servers 87%&lt;/li&gt;
&lt;li&gt;Using Flex in the Adobe integrated runtime (AIR) 80%&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I never used Adobe Air before friday, and made a cute little app in it yesterday to get to grips with the features (I'll be blogging about that here and on georgcook.org, in the near future). Other than that I watched some lynda training vids on Air (lynda training is a must for any new technology imho), and just skimmed through my old revision notes. So if you're about to take the exam, take a look at my notes about flex 2.&lt;/p&gt;

&lt;p&gt;I didn't use ATest this time round, as Dave, the very nice guy at PXL is too busy, and possibly a little bit unfocused on just making a mock test for it : he's trying to make some sort of education platform, which is great of course, but he must be losing an awful lot of ATest sales.&lt;/p&gt;

&lt;p&gt;Regardless. If you've worked with flex for anytime it will be a breeze. If not : READ THE DOCUMENTATION. Noone ever does this. I work with people who never read the manuals - it's so dissapointing, especially when these guys come from Java, or .NET and think they know it all, but have never even opened the user guide, other than to solve a specific problem.&lt;/p&gt;

&lt;p&gt;So there you have it kids. It's easy, don't stress about it, and read the docs. You'll breeze through it.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://lifeonrails.org/">
    <author>
      <name>georgejcook</name>
    </author>
    <id>tag:lifeonrails.org,2009-01-23:9767</id>
    <published>2009-01-23T00:12:00Z</published>
    <updated>2009-02-19T19:42:43Z</updated>
    <category term="flex"/>
    <category term="flex"/>
    <category term="hbox"/>
    <category term="incudeinlayout"/>
    <category term="layoutmanager"/>
    <category term="margin"/>
    <category term="padding"/>
    <category term="vbox"/>
    <link href="http://lifeonrails.org/2009/1/23/better-layoutmanager-better-vbox-hybridhbox" rel="alternate" type="text/html"/>
    <title>Better LayoutManager, Hybrid VBox, Hyrbid HBox</title>
<summary type="html">&lt;p&gt;This is a follow on from my previous post asking if you are getting the most out of includeinlayout, well I wasn't and I was sick of code like this:&lt;/p&gt;

&lt;ol class=&quot;CodeRay&quot;&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;&amp;lt;VBox&amp;gt;&lt;/li&gt;&lt;li&gt;&amp;lt;Component1 /&amp;gt;&lt;/li&gt;&lt;li&gt;&amp;lt;canvas&amp;gt;&lt;/li&gt;&lt;li&gt;&amp;lt;text left=20 text=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;the point of this is only to have an indent of 20 for this one item i the vbox&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; /&amp;gt;&lt;/li&gt;&lt;li&gt;&amp;lt;/canvas&amp;gt;&lt;/li&gt;&lt;li&gt;&amp;lt;Component3 /&amp;gt;&lt;/li&gt;&lt;li&gt;&amp;lt;/VBox&amp;gt;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;/ol&gt;

&lt;p&gt;The problem is that the LayoutManager used by Box (BoxLayout), though efficient and powerful, doesn't allow for the concept of margins. In flex we can pad within a component, but any component we make can't add a margin around itself. &lt;/p&gt;

&lt;p&gt;I've got here a crude exmaple which covers the majority of cases that I would normally want, and can cut out most of the need for the extraneous canvas above.&lt;/p&gt;

&lt;p&gt;With the hybrid vbox (HVBOX) you can do the following:&lt;/p&gt;

&lt;ol class=&quot;CodeRay&quot;&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;&amp;lt;local:HVBOX&amp;gt;&lt;/li&gt;&lt;li&gt;      &amp;lt;mx:&lt;span class=&quot;pt&quot;&gt;Button&lt;/span&gt; width=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; label=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; /&amp;gt;&lt;/li&gt;&lt;li&gt;      &amp;lt;mx:&lt;span class=&quot;pt&quot;&gt;Button&lt;/span&gt; width=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; label=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;test2&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;/li&gt;&lt;li&gt;          top=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;/li&gt;&lt;li&gt;          left=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;          right=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;          /&amp;gt;&lt;/li&gt;&lt;li&gt;      &amp;lt;mx:&lt;span class=&quot;pt&quot;&gt;Button&lt;/span&gt; width=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; label=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;test3&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;        top=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; /&amp;gt;&lt;/li&gt;&lt;li&gt;      &amp;lt;mx:&lt;span class=&quot;pt&quot;&gt;Button&lt;/span&gt; width=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; label=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;test FLOAT&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;        y=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; x=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;        includeInLayout=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; /&amp;gt;&lt;/li&gt;&lt;li&gt;      &lt;/li&gt;&lt;li&gt;    &amp;lt;/local:HVBOX&amp;gt;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;/ol&gt;

&lt;p&gt;In the previous code examples, the top, left, right and bottom properties will apply a margin around the control. 
This syntax works for vbbox and hbox alike, and in both cases, will cause the control to shrink on the axis that is not being stretched (e.g. if you set margins left and right on a compoenent in the vbox, then the control will shrink left and right to fit in with the rest of the vbox, thus giving you padding on an individual basis ).&lt;/p&gt;

&lt;p&gt;While I was at it, I also added a simple refinement that means you can mix non vbox laid out components as well as vbox laid out components, look at the last component. It has includeinlayout set to false, but visible is true. Note the x and y settings, these will be observed WITHIN the vbox - no need to layoutchrome or wrap in a canvas. :D&lt;/p&gt;

&lt;p&gt;This can be further improved for sure (my measuring is very crude), but as I said this catches the majority of cases I need. oh, and the name sucks as I only whipped it up in 20 minutes to blog to you here, dear reader:&lt;/p&gt;</summary><content type="html">
            &lt;p&gt;This is a follow on from my previous post asking if you are getting the most out of includeinlayout, well I wasn't and I was sick of code like this:&lt;/p&gt;

&lt;ol class=&quot;CodeRay&quot;&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;&amp;lt;VBox&amp;gt;&lt;/li&gt;&lt;li&gt;&amp;lt;Component1 /&amp;gt;&lt;/li&gt;&lt;li&gt;&amp;lt;canvas&amp;gt;&lt;/li&gt;&lt;li&gt;&amp;lt;text left=20 text=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;the point of this is only to have an indent of 20 for this one item i the vbox&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; /&amp;gt;&lt;/li&gt;&lt;li&gt;&amp;lt;/canvas&amp;gt;&lt;/li&gt;&lt;li&gt;&amp;lt;Component3 /&amp;gt;&lt;/li&gt;&lt;li&gt;&amp;lt;/VBox&amp;gt;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;/ol&gt;

&lt;p&gt;The problem is that the LayoutManager used by Box (BoxLayout), though efficient and powerful, doesn't allow for the concept of margins. In flex we can pad within a component, but any component we make can't add a margin around itself. &lt;/p&gt;

&lt;p&gt;I've got here a crude exmaple which covers the majority of cases that I would normally want, and can cut out most of the need for the extraneous canvas above.&lt;/p&gt;

&lt;p&gt;With the hybrid vbox (HVBOX) you can do the following:&lt;/p&gt;

&lt;ol class=&quot;CodeRay&quot;&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;&amp;lt;local:HVBOX&amp;gt;&lt;/li&gt;&lt;li&gt;      &amp;lt;mx:&lt;span class=&quot;pt&quot;&gt;Button&lt;/span&gt; width=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; label=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; /&amp;gt;&lt;/li&gt;&lt;li&gt;      &amp;lt;mx:&lt;span class=&quot;pt&quot;&gt;Button&lt;/span&gt; width=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; label=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;test2&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;/li&gt;&lt;li&gt;          top=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;/li&gt;&lt;li&gt;          left=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;          right=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;          /&amp;gt;&lt;/li&gt;&lt;li&gt;      &amp;lt;mx:&lt;span class=&quot;pt&quot;&gt;Button&lt;/span&gt; width=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; label=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;test3&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;        top=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; /&amp;gt;&lt;/li&gt;&lt;li&gt;      &amp;lt;mx:&lt;span class=&quot;pt&quot;&gt;Button&lt;/span&gt; width=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; label=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;test FLOAT&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;        y=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; x=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;        includeInLayout=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; /&amp;gt;&lt;/li&gt;&lt;li&gt;      &lt;/li&gt;&lt;li&gt;    &amp;lt;/local:HVBOX&amp;gt;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;/ol&gt;

&lt;p&gt;In the previous code examples, the top, left, right and bottom properties will apply a margin around the control. 
This syntax works for vbbox and hbox alike, and in both cases, will cause the control to shrink on the axis that is not being stretched (e.g. if you set margins left and right on a compoenent in the vbox, then the control will shrink left and right to fit in with the rest of the vbox, thus giving you padding on an individual basis ).&lt;/p&gt;

&lt;p&gt;While I was at it, I also added a simple refinement that means you can mix non vbox laid out components as well as vbox laid out components, look at the last component. It has includeinlayout set to false, but visible is true. Note the x and y settings, these will be observed WITHIN the vbox - no need to layoutchrome or wrap in a canvas. :D&lt;/p&gt;

&lt;p&gt;This can be further improved for sure (my measuring is very crude), but as I said this catches the majority of cases I need. oh, and the name sucks as I only whipped it up in 20 minutes to blog to you here, dear reader:&lt;/p&gt;
&lt;p&gt;This is a follow on from my previous post asking if you are getting the most out of includeinlayout, well I wasn't and I was sick of code like this:&lt;/p&gt;

&lt;ol class=&quot;CodeRay&quot;&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;&amp;lt;VBox&amp;gt;&lt;/li&gt;&lt;li&gt;&amp;lt;Component1 /&amp;gt;&lt;/li&gt;&lt;li&gt;&amp;lt;canvas&amp;gt;&lt;/li&gt;&lt;li&gt;&amp;lt;text left=20 text=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;the point of this is only to have an indent of 20 for this one item i the vbox&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; /&amp;gt;&lt;/li&gt;&lt;li&gt;&amp;lt;/canvas&amp;gt;&lt;/li&gt;&lt;li&gt;&amp;lt;Component3 /&amp;gt;&lt;/li&gt;&lt;li&gt;&amp;lt;/VBox&amp;gt;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;/ol&gt;

&lt;p&gt;The problem is that the LayoutManager used by Box (BoxLayout), though efficient and powerful, doesn't allow for the concept of margins. In flex we can pad within a component, but any component we make can't add a margin around itself. &lt;/p&gt;

&lt;p&gt;I've got here a crude exmaple which covers the majority of cases that I would normally want, and can cut out most of the need for the extraneous canvas above.&lt;/p&gt;

&lt;p&gt;With the hybrid vbox (HVBOX) you can do the following:&lt;/p&gt;

&lt;ol class=&quot;CodeRay&quot;&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;&amp;lt;local:HVBOX&amp;gt;&lt;/li&gt;&lt;li&gt;      &amp;lt;mx:&lt;span class=&quot;pt&quot;&gt;Button&lt;/span&gt; width=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; label=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; /&amp;gt;&lt;/li&gt;&lt;li&gt;      &amp;lt;mx:&lt;span class=&quot;pt&quot;&gt;Button&lt;/span&gt; width=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; label=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;test2&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;/li&gt;&lt;li&gt;          top=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;/li&gt;&lt;li&gt;          left=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;          right=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;          /&amp;gt;&lt;/li&gt;&lt;li&gt;      &amp;lt;mx:&lt;span class=&quot;pt&quot;&gt;Button&lt;/span&gt; width=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; label=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;test3&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;        top=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; /&amp;gt;&lt;/li&gt;&lt;li&gt;      &amp;lt;mx:&lt;span class=&quot;pt&quot;&gt;Button&lt;/span&gt; width=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; label=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;test FLOAT&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;        y=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; x=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;        includeInLayout=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; /&amp;gt;&lt;/li&gt;&lt;li&gt;      &lt;/li&gt;&lt;li&gt;    &amp;lt;/local:HVBOX&amp;gt;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;/ol&gt;

&lt;p&gt;In the previous code examples, the top, left, right and bottom properties will apply a margin around the control. 
This syntax works for vbbox and hbox alike, and in both cases, will cause the control to shrink on the axis that is not being stretched (e.g. if you set margins left and right on a compoenent in the vbox, then the control will shrink left and right to fit in with the rest of the vbox, thus giving you padding on an individual basis ).&lt;/p&gt;

&lt;p&gt;While I was at it, I also added a simple refinement that means you can mix non vbox laid out components as well as vbox laid out components, look at the last component. It has includeinlayout set to false, but visible is true. Note the x and y settings, these will be observed WITHIN the vbox - no need to layoutchrome or wrap in a canvas. :D&lt;/p&gt;

&lt;p&gt;This can be further improved for sure (my measuring is very crude), but as I said this catches the majority of cases I need. oh, and the name sucks as I only whipped it up in 20 minutes to blog to you here, dear reader:&lt;/p&gt;

&lt;p&gt;here it is, take it, improve it and post back what you did with it!&lt;/p&gt;

&lt;p&gt;oh, and if you want to see where I changed code, open up BoxLayout in eclipse and compare the measure and udpatelayoutmethods (hint, search my code for the getMarginMetricsForObject method, and call to getMarginMetricsForObject to find where I made my changes )&lt;/p&gt;

&lt;p&gt;HVBOX.mxml&lt;/p&gt;

&lt;ol class=&quot;CodeRay&quot;&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;r&quot;&gt;package&lt;/span&gt;&lt;/li&gt;&lt;li&gt;{&lt;/li&gt;&lt;li&gt;  &lt;span class=&quot;r&quot;&gt;import&lt;/span&gt; mx.containers.Box;&lt;/li&gt;&lt;li&gt;  &lt;span class=&quot;r&quot;&gt;import&lt;/span&gt; mx.containers.BoxDirection;&lt;/li&gt;&lt;li&gt;  &lt;span class=&quot;r&quot;&gt;import&lt;/span&gt; mx.core.mx_internal;&lt;/li&gt;&lt;li&gt;  use namespace mx_internal;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;  &lt;span class=&quot;r&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;class&lt;/span&gt; HVBOX &lt;span class=&quot;r&quot;&gt;extends&lt;/span&gt; Box&lt;/li&gt;&lt;li&gt;  {&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;function&lt;/span&gt; HVBOX()&lt;/li&gt;&lt;li&gt;    {&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;pc&quot;&gt;super&lt;/span&gt;();&lt;/li&gt;&lt;li&gt;      mx_internal::layoutObject = new HybridLayoutManager();&lt;/li&gt;&lt;li&gt;      mx_internal::layoutObject.target = &lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;;&lt;/li&gt;&lt;li&gt;      mx_internal::layoutObject.direction = BoxDirection.VERTICAL;&lt;/li&gt;&lt;li&gt;    }&lt;/li&gt;&lt;li&gt;    &lt;/li&gt;&lt;li&gt;  }&lt;/li&gt;&lt;li&gt;}&lt;/li&gt;&lt;/ol&gt;

&lt;p&gt;HHBOX.mxml&lt;/p&gt;

&lt;ol class=&quot;CodeRay&quot;&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;r&quot;&gt;package&lt;/span&gt;&lt;/li&gt;&lt;li&gt;{&lt;/li&gt;&lt;li&gt;  &lt;span class=&quot;r&quot;&gt;import&lt;/span&gt; mx.containers.Box;&lt;/li&gt;&lt;li&gt;  &lt;span class=&quot;r&quot;&gt;import&lt;/span&gt; mx.containers.BoxDirection;&lt;/li&gt;&lt;li&gt;  &lt;span class=&quot;r&quot;&gt;import&lt;/span&gt; mx.core.mx_internal;&lt;/li&gt;&lt;li&gt;  use namespace mx_internal;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;  &lt;span class=&quot;r&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;class&lt;/span&gt; HVBOX &lt;span class=&quot;r&quot;&gt;extends&lt;/span&gt; Box&lt;/li&gt;&lt;li&gt;  {&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;function&lt;/span&gt; HVBOX()&lt;/li&gt;&lt;li&gt;    {&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;pc&quot;&gt;super&lt;/span&gt;();&lt;/li&gt;&lt;li&gt;      mx_internal::layoutObject = new HybridLayoutManager();&lt;/li&gt;&lt;li&gt;      mx_internal::layoutObject.target = &lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;;&lt;/li&gt;&lt;li&gt;      mx_internal::layoutObject.direction = BoxDirection.VERTICAL;&lt;/li&gt;&lt;li&gt;    }&lt;/li&gt;&lt;li&gt;    &lt;/li&gt;&lt;li&gt;  }&lt;/li&gt;&lt;li&gt;}&lt;/li&gt;&lt;/ol&gt;

&lt;p&gt;BetterLayoutManager.as&lt;/p&gt;

&lt;ol class=&quot;CodeRay&quot;&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;r&quot;&gt;package&lt;/span&gt;&lt;/li&gt;&lt;li&gt;{&lt;/li&gt;&lt;li&gt;  &lt;span class=&quot;r&quot;&gt;import&lt;/span&gt; mx.containers.BoxDirection;&lt;/li&gt;&lt;li&gt;  &lt;span class=&quot;r&quot;&gt;import&lt;/span&gt; mx.containers.utilityClasses.BoxLayout;&lt;/li&gt;&lt;li&gt;  &lt;span class=&quot;r&quot;&gt;import&lt;/span&gt; mx.containers.utilityClasses.Flex;&lt;/li&gt;&lt;li&gt;  &lt;span class=&quot;r&quot;&gt;import&lt;/span&gt; mx.controls.scrollClasses.ScrollBar;&lt;/li&gt;&lt;li&gt;  &lt;span class=&quot;r&quot;&gt;import&lt;/span&gt; mx.core.Container;&lt;/li&gt;&lt;li&gt;  &lt;span class=&quot;r&quot;&gt;import&lt;/span&gt; mx.core.EdgeMetrics;&lt;/li&gt;&lt;li&gt;  &lt;span class=&quot;r&quot;&gt;import&lt;/span&gt; mx.core.IUIComponent;&lt;/li&gt;&lt;li&gt;  &lt;span class=&quot;r&quot;&gt;import&lt;/span&gt; mx.core.ScrollPolicy;&lt;/li&gt;&lt;li&gt;  &lt;span class=&quot;r&quot;&gt;import&lt;/span&gt; mx.core.UIComponent;&lt;/li&gt;&lt;li&gt;  &lt;span class=&quot;r&quot;&gt;import&lt;/span&gt; mx.core.mx_internal;&lt;/li&gt;&lt;li&gt;  &lt;span class=&quot;r&quot;&gt;import&lt;/span&gt; mx.styles.IStyleClient;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;  use namespace mx_internal;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;  &lt;span class=&quot;r&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;class&lt;/span&gt; HybridLayoutManager &lt;span class=&quot;r&quot;&gt;extends&lt;/span&gt; BoxLayout&lt;/li&gt;&lt;li&gt;  {&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;function&lt;/span&gt; HybridLayoutManager()&lt;/li&gt;&lt;li&gt;    {&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;pc&quot;&gt;super&lt;/span&gt;();&lt;/li&gt;&lt;li&gt;    }&lt;/li&gt;&lt;li&gt;    &lt;/li&gt;&lt;li&gt;    override &lt;span class=&quot;r&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;function&lt;/span&gt; updateDisplayList(unscaledWidth:&lt;span class=&quot;pt&quot;&gt;Number&lt;/span&gt;,&lt;/li&gt;&lt;li&gt;                         unscaledHeight:&lt;span class=&quot;pt&quot;&gt;Number&lt;/span&gt;):&lt;span class=&quot;r&quot;&gt;void&lt;/span&gt;&lt;/li&gt;&lt;li&gt;  {&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; target:Container = &lt;span class=&quot;pc&quot;&gt;super&lt;/span&gt;.target;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; n:&lt;span class=&quot;r&quot;&gt;int&lt;/span&gt; = target.numChildren;&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; (n == 0)&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;r&quot;&gt;return&lt;/span&gt;;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; vm:EdgeMetrics = target.viewMetricsAndPadding;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; paddingLeft:&lt;span class=&quot;pt&quot;&gt;Number&lt;/span&gt; = target.getStyle(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;paddingLeft&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;);&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; paddingTop:&lt;span class=&quot;pt&quot;&gt;Number&lt;/span&gt; = target.getStyle(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;paddingTop&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;);&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; horizontalAlign:&lt;span class=&quot;pt&quot;&gt;Number&lt;/span&gt; = getHorizontalAlignValue();&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; verticalAlign:&lt;span class=&quot;pt&quot;&gt;Number&lt;/span&gt; = getVerticalAlignValue();&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; mw:&lt;span class=&quot;pt&quot;&gt;Number&lt;/span&gt; = target.scaleX &amp;gt; 0 &amp;amp;&amp;amp; target.scaleX != 1 ?&lt;/li&gt;&lt;li&gt;            target.minWidth / &lt;span class=&quot;pt&quot;&gt;Math&lt;/span&gt;.&lt;span class=&quot;fu&quot;&gt;abs&lt;/span&gt;(target.scaleX) :&lt;/li&gt;&lt;li&gt;            target.minWidth;&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; mh:&lt;span class=&quot;pt&quot;&gt;Number&lt;/span&gt; = target.scaleY &amp;gt; 0 &amp;amp;&amp;amp; target.scaleY != 1 ?&lt;/li&gt;&lt;li&gt;            target.minHeight / &lt;span class=&quot;pt&quot;&gt;Math&lt;/span&gt;.&lt;span class=&quot;fu&quot;&gt;abs&lt;/span&gt;(target.scaleY) :&lt;/li&gt;&lt;li&gt;            target.minHeight;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; w:&lt;span class=&quot;pt&quot;&gt;Number&lt;/span&gt; = &lt;span class=&quot;pt&quot;&gt;Math&lt;/span&gt;.&lt;span class=&quot;fu&quot;&gt;max&lt;/span&gt;(unscaledWidth, mw) - vm.right - vm.left;&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; h:&lt;span class=&quot;pt&quot;&gt;Number&lt;/span&gt; = &lt;span class=&quot;pt&quot;&gt;Math&lt;/span&gt;.&lt;span class=&quot;fu&quot;&gt;max&lt;/span&gt;(unscaledHeight, mh) - vm.bottom - vm.top;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; horizontalScrollBar:ScrollBar = target.horizontalScrollBar;&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; verticalScrollBar:ScrollBar = target.verticalScrollBar;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; gap:&lt;span class=&quot;pt&quot;&gt;Number&lt;/span&gt;;&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; numChildrenWithOwnSpace:&lt;span class=&quot;r&quot;&gt;int&lt;/span&gt;;&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; excessSpace:&lt;span class=&quot;pt&quot;&gt;Number&lt;/span&gt;;&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; top:&lt;span class=&quot;pt&quot;&gt;Number&lt;/span&gt;;&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; left:&lt;span class=&quot;pt&quot;&gt;Number&lt;/span&gt;;&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; i:&lt;span class=&quot;r&quot;&gt;int&lt;/span&gt;;&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; obj:IUIComponent;&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; m : EdgeMetrics;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; (n == 1)&lt;/li&gt;&lt;li&gt;    {&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;c&quot;&gt;// This is an optimized code path for the case where there's one&lt;/span&gt;&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;c&quot;&gt;// child. This case is especially common when the Box is really&lt;/span&gt;&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;c&quot;&gt;// a GridItem. This code path works for both horizontal and&lt;/span&gt;&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;c&quot;&gt;// vertical layout.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; child:IUIComponent = IUIComponent(target.getChildAt(0));&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; percentWidth:&lt;span class=&quot;pt&quot;&gt;Number&lt;/span&gt; = child.percentWidth;&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; percentHeight:&lt;span class=&quot;pt&quot;&gt;Number&lt;/span&gt; = child.percentHeight;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; width:&lt;span class=&quot;pt&quot;&gt;Number&lt;/span&gt;;&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; (percentWidth)&lt;/li&gt;&lt;li&gt;      {&lt;/li&gt;&lt;li&gt;        width = &lt;span class=&quot;pt&quot;&gt;Math&lt;/span&gt;.&lt;span class=&quot;fu&quot;&gt;max&lt;/span&gt;(child.minWidth,&lt;/li&gt;&lt;li&gt;          &lt;span class=&quot;pt&quot;&gt;Math&lt;/span&gt;.&lt;span class=&quot;fu&quot;&gt;min&lt;/span&gt;(child.maxWidth,&lt;/li&gt;&lt;li&gt;          ((percentWidth &amp;gt;= 100) ? w : (w * percentWidth / 100))));&lt;/li&gt;&lt;li&gt;      }&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;r&quot;&gt;else&lt;/span&gt;&lt;/li&gt;&lt;li&gt;      {&lt;/li&gt;&lt;li&gt;        width = child.getExplicitOrMeasuredWidth();&lt;/li&gt;&lt;li&gt;      }&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; height:&lt;span class=&quot;pt&quot;&gt;Number&lt;/span&gt;&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; (percentHeight)&lt;/li&gt;&lt;li&gt;      {&lt;/li&gt;&lt;li&gt;        height = &lt;span class=&quot;pt&quot;&gt;Math&lt;/span&gt;.&lt;span class=&quot;fu&quot;&gt;max&lt;/span&gt;(child.minHeight,&lt;/li&gt;&lt;li&gt;          &lt;span class=&quot;pt&quot;&gt;Math&lt;/span&gt;.&lt;span class=&quot;fu&quot;&gt;min&lt;/span&gt;(child.maxHeight,&lt;/li&gt;&lt;li&gt;          ((percentHeight &amp;gt;= 100) ? h : (h * percentHeight / 100))));&lt;/li&gt;&lt;li&gt;      }&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;r&quot;&gt;else&lt;/span&gt;&lt;/li&gt;&lt;li&gt;      {&lt;/li&gt;&lt;li&gt;        height = child.getExplicitOrMeasuredHeight();&lt;/li&gt;&lt;li&gt;      }&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;c&quot;&gt;// if scaled and zoom is playing, best to let the sizes be non-integer&lt;/span&gt;&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; (child.scaleX == 1 &amp;amp;&amp;amp; child.scaleY == 1)&lt;/li&gt;&lt;li&gt;        child.setActualSize(&lt;span class=&quot;pt&quot;&gt;Math&lt;/span&gt;.&lt;span class=&quot;fu&quot;&gt;floor&lt;/span&gt;(width), &lt;span class=&quot;pt&quot;&gt;Math&lt;/span&gt;.&lt;span class=&quot;fu&quot;&gt;floor&lt;/span&gt;(height));&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;r&quot;&gt;else&lt;/span&gt;&lt;/li&gt;&lt;li&gt;        child.setActualSize(width, height);&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;c&quot;&gt;// Ignore scrollbar sizes for child alignment purpose.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; (verticalScrollBar != &lt;span class=&quot;pc&quot;&gt;null&lt;/span&gt; &amp;amp;&amp;amp;&lt;/li&gt;&lt;li&gt;        target.verticalScrollPolicy == ScrollPolicy.AUTO)&lt;/li&gt;&lt;li&gt;      {&lt;/li&gt;&lt;li&gt;        w += verticalScrollBar.minWidth;&lt;/li&gt;&lt;li&gt;      }&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; (horizontalScrollBar != &lt;span class=&quot;pc&quot;&gt;null&lt;/span&gt; &amp;amp;&amp;amp;&lt;/li&gt;&lt;li&gt;        target.horizontalScrollPolicy == ScrollPolicy.AUTO)&lt;/li&gt;&lt;li&gt;      {&lt;/li&gt;&lt;li&gt;        h += horizontalScrollBar.minHeight;&lt;/li&gt;&lt;li&gt;      }&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;c&quot;&gt;// Use the child's width and height because a Resize effect might&lt;/span&gt;&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;c&quot;&gt;// have changed the child's dimensions. Bug 146158.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;      left = (w - child.width) * horizontalAlign + paddingLeft;&lt;/li&gt;&lt;li&gt;      top = (h - child.height) * verticalAlign + paddingTop;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;      child.move(&lt;span class=&quot;pt&quot;&gt;Math&lt;/span&gt;.&lt;span class=&quot;fu&quot;&gt;floor&lt;/span&gt;(left), &lt;span class=&quot;pt&quot;&gt;Math&lt;/span&gt;.&lt;span class=&quot;fu&quot;&gt;floor&lt;/span&gt;(top));&lt;/li&gt;&lt;li&gt;    }&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; (isVertical()) &lt;span class=&quot;c&quot;&gt;// VBOX&lt;/span&gt;&lt;/li&gt;&lt;li&gt;    {&lt;/li&gt;&lt;li&gt;      gap = target.getStyle(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;verticalGap&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;);&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;      numChildrenWithOwnSpace = n;&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;r&quot;&gt;for&lt;/span&gt; (i = 0; i &amp;lt; n; i++)&lt;/li&gt;&lt;li&gt;      {&lt;/li&gt;&lt;li&gt;        &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; (!IUIComponent(target.getChildAt(i)).includeInLayout)&lt;/li&gt;&lt;li&gt;          numChildrenWithOwnSpace--;&lt;/li&gt;&lt;li&gt;      }&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;c&quot;&gt;// Stretch everything as needed, including widths.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;      excessSpace = Flex.flexChildHeightsProportionally(&lt;/li&gt;&lt;li&gt;        target, h - (numChildrenWithOwnSpace - 1) * gap, w);&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;c&quot;&gt;// Ignore scrollbar sizes for child alignment purpose.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; (horizontalScrollBar != &lt;span class=&quot;pc&quot;&gt;null&lt;/span&gt; &amp;amp;&amp;amp;&lt;/li&gt;&lt;li&gt;        target.horizontalScrollPolicy == ScrollPolicy.AUTO)&lt;/li&gt;&lt;li&gt;      {&lt;/li&gt;&lt;li&gt;        excessSpace += horizontalScrollBar.minHeight;&lt;/li&gt;&lt;li&gt;      }&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; (verticalScrollBar != &lt;span class=&quot;pc&quot;&gt;null&lt;/span&gt; &amp;amp;&amp;amp;&lt;/li&gt;&lt;li&gt;        target.verticalScrollPolicy == ScrollPolicy.AUTO)&lt;/li&gt;&lt;li&gt;      {&lt;/li&gt;&lt;li&gt;        w += verticalScrollBar.minWidth;&lt;/li&gt;&lt;li&gt;      }&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;      top = paddingTop + excessSpace * verticalAlign;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;r&quot;&gt;for&lt;/span&gt; (i = 0; i &amp;lt; n; i++)&lt;/li&gt;&lt;li&gt;      {&lt;/li&gt;&lt;li&gt;        obj = IUIComponent(target.getChildAt(i));&lt;/li&gt;&lt;li&gt;        left = (w - obj.width) * horizontalAlign + paddingLeft;&lt;/li&gt;&lt;li&gt;        &lt;/li&gt;&lt;li&gt;        &lt;/li&gt;&lt;li&gt;        &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; (obj.includeInLayout)&lt;/li&gt;&lt;li&gt;        {&lt;/li&gt;&lt;li&gt;          m = getMarginMetricsForObject( obj );&lt;/li&gt;&lt;li&gt;          top += m.top;&lt;/li&gt;&lt;li&gt;          obj.move( &lt;span class=&quot;pt&quot;&gt;Math&lt;/span&gt;.&lt;span class=&quot;fu&quot;&gt;floor&lt;/span&gt;(left + m.left ), &lt;span class=&quot;pt&quot;&gt;Math&lt;/span&gt;.&lt;span class=&quot;fu&quot;&gt;floor&lt;/span&gt;(top));&lt;/li&gt;&lt;li&gt;          &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; ( m.left &amp;gt; 0 || m.right &amp;gt; 0 )&lt;/li&gt;&lt;li&gt;          obj.setActualSize( obj.width - ( m.left + m.right ), obj.height );&lt;/li&gt;&lt;li&gt;          top += obj.height + gap + m.bottom;&lt;/li&gt;&lt;li&gt;        }&lt;/li&gt;&lt;li&gt;      }&lt;/li&gt;&lt;li&gt;    }&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;else&lt;/span&gt;  &lt;span class=&quot;c&quot;&gt;// HBOX&lt;/span&gt;&lt;/li&gt;&lt;li&gt;    {&lt;/li&gt;&lt;li&gt;      gap = target.getStyle(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;horizontalGap&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;);&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;      numChildrenWithOwnSpace = n;&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;r&quot;&gt;for&lt;/span&gt; (i = 0; i &amp;lt; n; i++)&lt;/li&gt;&lt;li&gt;      {&lt;/li&gt;&lt;li&gt;        &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; (!IUIComponent(target.getChildAt(i)).includeInLayout)&lt;/li&gt;&lt;li&gt;          numChildrenWithOwnSpace--;&lt;/li&gt;&lt;li&gt;      }&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;c&quot;&gt;// stretch everything as needed including heights&lt;/span&gt;&lt;/li&gt;&lt;li&gt;      excessSpace = Flex.flexChildWidthsProportionally(&lt;/li&gt;&lt;li&gt;        target, w - (numChildrenWithOwnSpace - 1) * gap, h);&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;c&quot;&gt;// Ignore scrollbar sizes for child alignment purpose.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; (horizontalScrollBar != &lt;span class=&quot;pc&quot;&gt;null&lt;/span&gt; &amp;amp;&amp;amp;&lt;/li&gt;&lt;li&gt;        target.horizontalScrollPolicy == ScrollPolicy.AUTO)&lt;/li&gt;&lt;li&gt;      {&lt;/li&gt;&lt;li&gt;        h += horizontalScrollBar.minHeight;&lt;/li&gt;&lt;li&gt;      }&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; (verticalScrollBar != &lt;span class=&quot;pc&quot;&gt;null&lt;/span&gt; &amp;amp;&amp;amp;&lt;/li&gt;&lt;li&gt;        target.verticalScrollPolicy == ScrollPolicy.AUTO)&lt;/li&gt;&lt;li&gt;      {&lt;/li&gt;&lt;li&gt;        excessSpace += verticalScrollBar.minWidth;&lt;/li&gt;&lt;li&gt;      }&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;      left = paddingLeft + excessSpace * horizontalAlign;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;r&quot;&gt;for&lt;/span&gt; (i = 0; i &amp;lt; n; i++)&lt;/li&gt;&lt;li&gt;      {&lt;/li&gt;&lt;li&gt;        obj = IUIComponent(target.getChildAt(i));&lt;/li&gt;&lt;li&gt;        top = (h - obj.height) * verticalAlign + paddingTop;&lt;/li&gt;&lt;li&gt;        &lt;/li&gt;&lt;li&gt;          &lt;/li&gt;&lt;li&gt;        &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; (obj.includeInLayout)&lt;/li&gt;&lt;li&gt;        {&lt;/li&gt;&lt;li&gt;          m = getMarginMetricsForObject( obj );&lt;/li&gt;&lt;li&gt;          left += m.left;&lt;/li&gt;&lt;li&gt;          obj.move(&lt;span class=&quot;pt&quot;&gt;Math&lt;/span&gt;.&lt;span class=&quot;fu&quot;&gt;floor&lt;/span&gt;(left), &lt;span class=&quot;pt&quot;&gt;Math&lt;/span&gt;.&lt;span class=&quot;fu&quot;&gt;floor&lt;/span&gt;(top));&lt;/li&gt;&lt;li&gt;          obj.move( &lt;span class=&quot;pt&quot;&gt;Math&lt;/span&gt;.&lt;span class=&quot;fu&quot;&gt;floor&lt;/span&gt;(left ), &lt;span class=&quot;pt&quot;&gt;Math&lt;/span&gt;.&lt;span class=&quot;fu&quot;&gt;floor&lt;/span&gt;(top + m.top ));&lt;/li&gt;&lt;li&gt;          &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; ( m.top &amp;gt; 0 || m.bottom &amp;gt; 0 )&lt;/li&gt;&lt;li&gt;            obj.setActualSize( obj.width , obj.height - ( m.top + m.bottom ) );&lt;/li&gt;&lt;li&gt;          left += obj.width + gap + m.right;&lt;/li&gt;&lt;li&gt;        }&lt;/li&gt;&lt;li&gt;      }&lt;/li&gt;&lt;li&gt;    }&lt;/li&gt;&lt;li&gt;  }&lt;/li&gt;&lt;li&gt;  &lt;/li&gt;&lt;li&gt;  override &lt;span class=&quot;r&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;function&lt;/span&gt; measure():&lt;span class=&quot;r&quot;&gt;void&lt;/span&gt;&lt;/li&gt;&lt;li&gt;  {&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; target:Container = &lt;span class=&quot;pc&quot;&gt;super&lt;/span&gt;.target;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; isVertical:&lt;span class=&quot;pt&quot;&gt;Boolean&lt;/span&gt; = isVertical();&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; minWidth:&lt;span class=&quot;pt&quot;&gt;Number&lt;/span&gt; = 0;&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; minHeight:&lt;span class=&quot;pt&quot;&gt;Number&lt;/span&gt; = 0;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; preferredWidth:&lt;span class=&quot;pt&quot;&gt;Number&lt;/span&gt; = 0;&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; preferredHeight:&lt;span class=&quot;pt&quot;&gt;Number&lt;/span&gt; = 0;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; n:&lt;span class=&quot;r&quot;&gt;int&lt;/span&gt; = target.numChildren;&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; numChildrenWithOwnSpace:&lt;span class=&quot;r&quot;&gt;int&lt;/span&gt; = n;&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; marginTop : &lt;span class=&quot;pt&quot;&gt;Number&lt;/span&gt;;&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; marginBottom : &lt;span class=&quot;pt&quot;&gt;Number&lt;/span&gt;;&lt;/li&gt;&lt;li&gt;    &lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;for&lt;/span&gt; (&lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; i:&lt;span class=&quot;r&quot;&gt;int&lt;/span&gt; = 0; i &amp;lt; n; i++)&lt;/li&gt;&lt;li&gt;    {&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; child:IUIComponent = IUIComponent(target.getChildAt(i));&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; (!child.includeInLayout)&lt;/li&gt;&lt;li&gt;      {&lt;/li&gt;&lt;li&gt;        numChildrenWithOwnSpace--;&lt;/li&gt;&lt;li&gt;        &lt;span class=&quot;r&quot;&gt;continue&lt;/span&gt;;&lt;/li&gt;&lt;li&gt;      }&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; wPref:&lt;span class=&quot;pt&quot;&gt;Number&lt;/span&gt; = child.getExplicitOrMeasuredWidth();&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; hPref:&lt;span class=&quot;pt&quot;&gt;Number&lt;/span&gt; = child.getExplicitOrMeasuredHeight();&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; m : EdgeMetrics = getMarginMetricsForObject( child );&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; (isVertical)&lt;/li&gt;&lt;li&gt;      {&lt;/li&gt;&lt;li&gt;        minWidth = &lt;span class=&quot;pt&quot;&gt;Math&lt;/span&gt;.&lt;span class=&quot;fu&quot;&gt;max&lt;/span&gt;(!&lt;span class=&quot;fu&quot;&gt;isNaN&lt;/span&gt;(child.percentWidth) ?&lt;/li&gt;&lt;li&gt;          child.minWidth : wPref, minWidth);&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;        preferredWidth = &lt;span class=&quot;pt&quot;&gt;Math&lt;/span&gt;.&lt;span class=&quot;fu&quot;&gt;max&lt;/span&gt;(wPref, preferredWidth);&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;        minHeight += !&lt;span class=&quot;fu&quot;&gt;isNaN&lt;/span&gt;(child.percentHeight) ?&lt;/li&gt;&lt;li&gt;          child.minHeight : hPref;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;        preferredHeight += hPref + m.top + m.bottom;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;      }&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;r&quot;&gt;else&lt;/span&gt;&lt;/li&gt;&lt;li&gt;      {&lt;/li&gt;&lt;li&gt;        minWidth += !&lt;span class=&quot;fu&quot;&gt;isNaN&lt;/span&gt;(child.percentWidth) ?&lt;/li&gt;&lt;li&gt;          child.minWidth : wPref;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;        preferredWidth += wPref + m.left + m.right;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;        minHeight = &lt;span class=&quot;pt&quot;&gt;Math&lt;/span&gt;.&lt;span class=&quot;fu&quot;&gt;max&lt;/span&gt;(!&lt;span class=&quot;fu&quot;&gt;isNaN&lt;/span&gt;(child.percentHeight) ?&lt;/li&gt;&lt;li&gt;          child.minHeight : hPref, minHeight);&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;        preferredHeight = &lt;span class=&quot;pt&quot;&gt;Math&lt;/span&gt;.&lt;span class=&quot;fu&quot;&gt;max&lt;/span&gt;(hPref, preferredHeight);&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;      }&lt;/li&gt;&lt;li&gt;    }&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; wPadding:&lt;span class=&quot;pt&quot;&gt;Number&lt;/span&gt; = widthPadding(numChildrenWithOwnSpace);&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; hPadding:&lt;span class=&quot;pt&quot;&gt;Number&lt;/span&gt; = heightPadding(numChildrenWithOwnSpace);&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;    target.measuredMinWidth = minWidth + wPadding;&lt;/li&gt;&lt;li&gt;    target.measuredMinHeight = minHeight + hPadding;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;    target.measuredWidth = preferredWidth + wPadding;&lt;/li&gt;&lt;li&gt;    target.measuredHeight = preferredHeight + hPadding;&lt;/li&gt;&lt;li&gt;  }&lt;/li&gt;&lt;li&gt;  &lt;/li&gt;&lt;li&gt;  &lt;span class=&quot;r&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;function&lt;/span&gt; getMarginMetricsForObject( child : IUIComponent ) : EdgeMetrics&lt;/li&gt;&lt;li&gt;  {&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; t : &lt;span class=&quot;pt&quot;&gt;Number&lt;/span&gt; = 0;&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; l : &lt;span class=&quot;pt&quot;&gt;Number&lt;/span&gt; = 0;&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; r : &lt;span class=&quot;pt&quot;&gt;Number&lt;/span&gt; = 0;&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; b : &lt;span class=&quot;pt&quot;&gt;Number&lt;/span&gt; = 0;&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; ( child is IStyleClient )&lt;/li&gt;&lt;li&gt;    {&lt;/li&gt;&lt;li&gt;      t = IStyleClient( child ).getStyle( &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;top&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; );&lt;/li&gt;&lt;li&gt;      t = &lt;span class=&quot;fu&quot;&gt;isNaN&lt;/span&gt;( t ) ? 0 : t;&lt;/li&gt;&lt;li&gt;      b = IStyleClient( child ).getStyle( &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;bottom&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; );&lt;/li&gt;&lt;li&gt;      b = &lt;span class=&quot;fu&quot;&gt;isNaN&lt;/span&gt;( b ) ? 0 : b;&lt;/li&gt;&lt;li&gt;      l = IStyleClient( child ).getStyle( &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;left&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; );&lt;/li&gt;&lt;li&gt;      l = &lt;span class=&quot;fu&quot;&gt;isNaN&lt;/span&gt;( l ) ? 0 : l;&lt;/li&gt;&lt;li&gt;      r = IStyleClient( child ).getStyle( &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;right&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; );&lt;/li&gt;&lt;li&gt;      r = &lt;span class=&quot;fu&quot;&gt;isNaN&lt;/span&gt;( r ) ? 0 : r;&lt;/li&gt;&lt;li&gt;    }&lt;/li&gt;&lt;li&gt;        &lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;return&lt;/span&gt; new EdgeMetrics( l, t, r, b );&lt;/li&gt;&lt;li&gt;  } &lt;/li&gt;&lt;li&gt;  &lt;/li&gt;&lt;li&gt;  &lt;/li&gt;&lt;li&gt;  &lt;span class=&quot;r&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;function&lt;/span&gt; isVertical():&lt;span class=&quot;pt&quot;&gt;Boolean&lt;/span&gt;&lt;/li&gt;&lt;li&gt;  {&lt;/li&gt;&lt;li&gt;    &lt;span class=&quot;r&quot;&gt;return&lt;/span&gt; direction != BoxDirection.HORIZONTAL;&lt;/li&gt;&lt;li&gt;  }&lt;/li&gt;&lt;li&gt;    &lt;/li&gt;&lt;li&gt;  }&lt;/li&gt;&lt;li&gt;}&lt;/li&gt;&lt;/ol&gt;

&lt;p&gt;demo.mxml&lt;/p&gt;

&lt;ol class=&quot;CodeRay&quot;&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;&amp;lt;?xml version=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;1.0&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; encoding=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;utf-8&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;?&amp;gt;&lt;/li&gt;&lt;li&gt;&amp;lt;mx:Application xmlns:mx=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;http://www.adobe.com/2006/mxml&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; layout=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;vertical&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; xmlns:local=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&amp;gt;&lt;/li&gt;&lt;li&gt;  &amp;lt;mx:HBox&amp;gt;&lt;/li&gt;&lt;li&gt;    &amp;lt;local:HVBOX&amp;gt;&lt;/li&gt;&lt;li&gt;      &amp;lt;mx:&lt;span class=&quot;pt&quot;&gt;Button&lt;/span&gt; width=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; label=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; /&amp;gt;&lt;/li&gt;&lt;li&gt;      &amp;lt;mx:&lt;span class=&quot;pt&quot;&gt;Button&lt;/span&gt; width=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; label=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;test2&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;/li&gt;&lt;li&gt;          top=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;/li&gt;&lt;li&gt;          left=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;          right=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;          /&amp;gt;&lt;/li&gt;&lt;li&gt;      &amp;lt;mx:&lt;span class=&quot;pt&quot;&gt;Button&lt;/span&gt; width=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; label=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;test3&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;        top=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; /&amp;gt;&lt;/li&gt;&lt;li&gt;      &amp;lt;mx:&lt;span class=&quot;pt&quot;&gt;Button&lt;/span&gt; width=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; label=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;test FLOAT&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;        y=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; x=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;        includeInLayout=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; /&amp;gt;&lt;/li&gt;&lt;li&gt;      &lt;/li&gt;&lt;li&gt;    &amp;lt;/local:HVBOX&amp;gt;&lt;/li&gt;&lt;li&gt;    &lt;/li&gt;&lt;li&gt;    &amp;lt;mx:VBox&amp;gt;&lt;/li&gt;&lt;li&gt;      &amp;lt;mx:&lt;span class=&quot;pt&quot;&gt;Button&lt;/span&gt; width=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; label=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; /&amp;gt;&lt;/li&gt;&lt;li&gt;      &amp;lt;mx:&lt;span class=&quot;pt&quot;&gt;Button&lt;/span&gt; width=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; label=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;test2&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; /&amp;gt;&lt;/li&gt;&lt;li&gt;      &amp;lt;mx:&lt;span class=&quot;pt&quot;&gt;Button&lt;/span&gt; width=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; label=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;test3&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; /&amp;gt;&lt;/li&gt;&lt;li&gt;      &lt;/li&gt;&lt;li&gt;    &amp;lt;/mx:VBox&amp;gt;&lt;/li&gt;&lt;li&gt;  &amp;lt;/mx:HBox&amp;gt;&lt;/li&gt;&lt;li&gt;  &amp;lt;mx:VBox&amp;gt;&lt;/li&gt;&lt;li&gt;    &amp;lt;local:HHBOX backgroundColor=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&amp;gt;&lt;/li&gt;&lt;li&gt;      &amp;lt;mx:&lt;span class=&quot;pt&quot;&gt;Button&lt;/span&gt; width=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; label=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; /&amp;gt;&lt;/li&gt;&lt;li&gt;      &amp;lt;mx:&lt;span class=&quot;pt&quot;&gt;Button&lt;/span&gt; width=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; label=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;test2&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;/li&gt;&lt;li&gt;          top=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;/li&gt;&lt;li&gt;          left=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;          right=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;          bottom=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;          /&amp;gt;&lt;/li&gt;&lt;li&gt;      &amp;lt;mx:&lt;span class=&quot;pt&quot;&gt;Button&lt;/span&gt; width=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; label=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;test3&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; right=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; /&amp;gt;&lt;/li&gt;&lt;li&gt;      &amp;lt;mx:&lt;span class=&quot;pt&quot;&gt;Button&lt;/span&gt; width=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; label=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;FT&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;        y=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; x=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;        includeInLayout=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; /&amp;gt;&lt;/li&gt;&lt;li&gt;      &lt;/li&gt;&lt;li&gt;    &amp;lt;/local:HHBOX&amp;gt;&lt;/li&gt;&lt;li&gt;    &lt;/li&gt;&lt;li&gt;    &amp;lt;mx:HBox&amp;gt;&lt;/li&gt;&lt;li&gt;      &amp;lt;mx:&lt;span class=&quot;pt&quot;&gt;Button&lt;/span&gt; width=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; label=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; /&amp;gt;&lt;/li&gt;&lt;li&gt;      &amp;lt;mx:&lt;span class=&quot;pt&quot;&gt;Button&lt;/span&gt; width=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; label=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;test2&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; /&amp;gt;&lt;/li&gt;&lt;li&gt;      &amp;lt;mx:&lt;span class=&quot;pt&quot;&gt;Button&lt;/span&gt; width=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; label=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;test3&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; /&amp;gt;&lt;/li&gt;&lt;li&gt;      &lt;/li&gt;&lt;li&gt;    &amp;lt;/mx:HBox&amp;gt;&lt;/li&gt;&lt;li&gt;  &amp;lt;/mx:VBox&amp;gt;&lt;/li&gt;&lt;li&gt;&amp;lt;/mx:Application&amp;gt;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;/ol&gt;
          </content>  </entry>
  <entry xml:base="http://lifeonrails.org/">
    <author>
      <name>georgejcook</name>
    </author>
    <id>tag:lifeonrails.org,2008-11-24:4752</id>
    <published>2008-11-24T22:52:00Z</published>
    <updated>2008-11-24T23:18:43Z</updated>
    <category term="me, a person"/>
    <category term="ace"/>
    <category term="adobe"/>
    <category term="air"/>
    <category term="flex 3 exam"/>
    <link href="http://lifeonrails.org/2008/11/24/cheeky-bastards" rel="alternate" type="text/html"/>
    <title>cheeky so and so</title>
<content type="html">
            &lt;p&gt;I can't believe this.&lt;/p&gt;

&lt;p&gt;I was just hunting around for anyone who has passed the flex 3 cert (which I am studying for, to update my flex 2 cert),.. incidentally an Indian chap has - Venkat Viswanathan  - Well done!!&lt;/p&gt;

&lt;p&gt;yeah, so I was looking about, and if you recall, when I did my Flex 2 ACE, I posted up on here about my notes and what I was up to..&lt;/p&gt;

&lt;p&gt;Here's a picture of their blog ( wont give the cheeky fucks the trackbacks ):
&lt;img src=&quot;http://www.lifeonrails.org/images/articles/ripoff.png&quot; alt=&quot;My hard earned notesl&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Look familiar?
&lt;a href=&quot;http://www.lifeonrails.org/2008/2/26/i-passed-my-adobe-flex-exam&quot;&gt;http://www.lifeonrails.org/2008/2/26/i-passed-my-adobe-flex-exam&lt;/a&gt;+&lt;/p&gt;

&lt;p&gt;these little herberts are taking my hard earned notes, and pasting them on their blog to pretend they did the work? What a cheek!?&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://lifeonrails.org/">
    <author>
      <name>georgejcook</name>
    </author>
    <id>tag:lifeonrails.org,2008-11-24:4750</id>
    <published>2008-11-24T22:49:00Z</published>
    <updated>2008-11-24T22:52:02Z</updated>
    <category term="flex"/>
    <category term="tips"/>
    <category term="containers"/>
    <category term="flex"/>
    <category term="includeinlayout"/>
    <category term="performance"/>
    <link href="http://lifeonrails.org/2008/11/24/are-you-getting-the-most-out-of-includeinlayout" rel="alternate" type="text/html"/>
    <title>Are you getting the most out of includeInLayout?</title>
<content type="html">
            &lt;p&gt;I often see code in many flex apps that looks like this:&lt;/p&gt;

&lt;ol class=&quot;CodeRay&quot;&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;&amp;lt;mx:Canvas&amp;gt;&lt;/li&gt;&lt;li&gt;&amp;lt;VBox&amp;gt;&lt;/li&gt;&lt;li&gt;&amp;lt;Component1 /&amp;gt;&lt;/li&gt;&lt;li&gt;&amp;lt;Component2 /&amp;gt;&lt;/li&gt;&lt;li&gt;&amp;lt;Component3 /&amp;gt;&lt;/li&gt;&lt;li&gt;&amp;lt;/VBox&amp;gt;&lt;/li&gt;&lt;li&gt;&amp;lt;!-- the following component is required to be place above both component 1 or 2, or the background underneath 1 or 2 --&amp;gt;&lt;/li&gt;&lt;li&gt;&amp;lt;Component4 x=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; y=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&amp;gt;&lt;/li&gt;&lt;li&gt;&amp;lt;/mx:Canvas&amp;gt;&lt;/li&gt;&lt;/ol&gt;

&lt;p&gt;The requirement to have component4 absolutely positioned, while the rest of the componets are positioned in accordance with a layout manager causes an extra container to be added. I've also seen this worked around by using the chrome (which I do myself when making template ViewStacks). &lt;/p&gt;

&lt;p&gt;I've recently made a lovely discovery (well, more like seen the patantly obvious). We all know that since flex 2.01, if you have a container with managed layout (such as a subclass of Box) that you can use the includeInLayout property to opt out of the layout scheme. We often use this in conjunction with the visible property.&lt;/p&gt;

&lt;p&gt;God knows why, but it seems myself or others haven't considered using this to achieve a hybrid of absoulte/managed layouts.&lt;/p&gt;

&lt;p&gt;I'm currently using this to great effect. To make it work the absolute position of your components that will be laid out manually must be set after the children are laid out. You can achieve this by using the CreationComplete event. In the cases where you envisage the layout changing after creation has occurred youy can override updateDisplaylist.&lt;/p&gt;

&lt;p&gt;Here's an example&lt;/p&gt;

&lt;ol class=&quot;CodeRay&quot;&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;&amp;lt;?xml version=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;1.0&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; encoding=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;utf-8&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;?&amp;gt;&lt;/li&gt;&lt;li&gt;&amp;lt;mx:VBox xmlns:mx=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;http://www.adobe.com/2006/mxml&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; width=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;400&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; height=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;300&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;  creationComplete=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;onCreationComplete()&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&amp;gt;&lt;/li&gt;&lt;li&gt;  &amp;lt;mx:Script&amp;gt;&lt;/li&gt;&lt;li&gt;    &amp;lt;![CDATA[&lt;/li&gt;&lt;li&gt;      &lt;span class=&quot;r&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;function&lt;/span&gt; onCreationComplete() : &lt;span class=&quot;r&quot;&gt;void&lt;/span&gt;&lt;/li&gt;&lt;li&gt;      {&lt;/li&gt;&lt;li&gt;        absoluteInAVbox.move( 50, 25 );&lt;/li&gt;&lt;li&gt;      }&lt;/li&gt;&lt;li&gt;    ]]&amp;gt;&lt;/li&gt;&lt;li&gt;  &amp;lt;/mx:Script&amp;gt;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;  &amp;lt;mx:&lt;span class=&quot;pt&quot;&gt;Button&lt;/span&gt; label=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;one&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; width=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;100%&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; height=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;/&amp;gt;&lt;/li&gt;&lt;li&gt;  &amp;lt;mx:&lt;span class=&quot;pt&quot;&gt;Button&lt;/span&gt; label=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;two&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; width=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;100%&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; height=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;    includeInLayout=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;/li&gt;&lt;li&gt;    /&amp;gt;&lt;/li&gt;&lt;li&gt;  &amp;lt;mx:&lt;span class=&quot;pt&quot;&gt;Image&lt;/span&gt; &lt;/li&gt;&lt;li&gt;    id =&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;absoluteInAVbox&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;    includeInLayout=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;/li&gt;&lt;li&gt;    height=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; width=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;    &amp;gt;&lt;/li&gt;&lt;li&gt;    &amp;lt;mx:source&amp;gt;file:////Users/georgecook/Pictures/Photo Booth/Photo 3.jpg&amp;lt;/mx:source&amp;gt;&lt;/li&gt;&lt;li&gt;  &amp;lt;/mx:&lt;span class=&quot;pt&quot;&gt;Image&lt;/span&gt;&amp;gt;&lt;/li&gt;&lt;li&gt;&amp;lt;/mx:VBox&amp;gt;&lt;/li&gt;&lt;/ol&gt;

&lt;p&gt;While I'm at it - .move is far better than .x and .y, as the latter cause the displayObject to invalidate. ;)&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://lifeonrails.org/">
    <author>
      <name>georgejcook</name>
    </author>
    <id>tag:lifeonrails.org,2008-10-26:3828</id>
    <published>2008-10-26T19:13:00Z</published>
    <updated>2008-10-26T22:43:14Z</updated>
    <category term="flex"/>
    <category term="flex"/>
    <category term="navigation"/>
    <category term="pms"/>
    <category term="view"/>
    <link href="http://lifeonrails.org/2008/10/26/nicer-navigation" rel="alternate" type="text/html"/>
    <title>Nicer navigation</title>
<content type="html">
            &lt;ol class=&quot;CodeRay&quot;&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;c&quot;&gt;//model class&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;r&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; selctedView : &lt;span class=&quot;r&quot;&gt;int&lt;/span&gt;;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;r&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;const&lt;/span&gt; VIEW_FIRST_SCREEN : &lt;span class=&quot;r&quot;&gt;int&lt;/span&gt; = 0;&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;r&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;const&lt;/span&gt; VIEW_USER_PROFILE : &lt;span class=&quot;r&quot;&gt;int&lt;/span&gt; = 0;&lt;/li&gt;&lt;li&gt;pubic &lt;span class=&quot;r&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;const&lt;/span&gt; VIEW_USER_PROFILE_SUB_SCREEN : &lt;span class=&quot;r&quot;&gt;int&lt;/span&gt; = 0;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;c&quot;&gt;//a view, that uses the model class as a pm&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;&amp;lt;ViewStack id=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;fubar&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; selectedIndex=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;{model.selectedView}&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; /&amp;gt;&lt;/li&gt;&lt;li&gt;&amp;lt;ButtonBar id=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;viewSelection&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; click=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;model.sleectedView = viewSelection.selectedIndex&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; /&amp;gt;&lt;/li&gt;&lt;/ol&gt;

&lt;p&gt;I hate the selectedIndex property of viewstack - I find it always leads to the messiest, most difficult code. Many times too many, I've had to refactor a part of an application that has ended up with terribly unreadabe and fragile code as a result of index constants, I think the reasons are as follows:&lt;/p&gt;

&lt;p&gt;The indexes are initially for one or two things, as the app is in its' first iterations,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;More indexes and views get added,&lt;/li&gt;
&lt;li&gt;People are busy, so they use the indexes to derive other variables, or for logic,&lt;/li&gt;
&lt;li&gt;Over time the dependencies on the index constants are far greater than just the the selected view, as more and more code has been added referring to the index constats,&lt;/li&gt;
&lt;li&gt;Around this point, someone wants to add a new view, or change the order of views - usually what happens then is that instead of refactoring the indexes, people tend to tack on sub viewstacks, and sub viewstack indexes that go with them, to facilitate the edge cases these new views have brough with them,&lt;/li&gt;
&lt;li&gt;With another layer of indexes the code is even more fragile, even harder to refactor, even harder to maintain and nye on impossible to read - ladies and gentlemen, please start dumping crap code in this class after 3.. 2.. 1..&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There have to be better ways of doing this - here's one I use a lot - I've included the abstract code as well, it's slightly longer to read, but I think it's much more simple and much more maitainable, and easier to work with&lt;/p&gt;

&lt;ol class=&quot;CodeRay&quot;&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;c&quot;&gt;//MyView&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&amp;lt;ViewStack id =&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;clearer&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; selectedIndex=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;{model.selectedViewIndex}&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; /&amp;gt;&lt;/li&gt;&lt;li&gt;&amp;lt;ButtonBar id=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;viewSelection&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; click=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;model.selectedViewIndex = viewSelection.selectedIndex&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; /&amp;gt;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;c&quot;&gt;//My PM&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;r&quot;&gt;class&lt;/span&gt; MyPM exteds BasePM&lt;/li&gt;&lt;li&gt;{&lt;/li&gt;&lt;li&gt;override &lt;span class=&quot;r&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;function&lt;/span&gt; initializeViews() : &lt;span class=&quot;r&quot;&gt;void&lt;/span&gt;&lt;/li&gt;&lt;li&gt;{&lt;/li&gt;&lt;li&gt;welcomeScreenPM  = new WelcomeScreenPM();&lt;/li&gt;&lt;li&gt;userProfilePM = new UserProfilePM();&lt;/li&gt;&lt;li&gt;userProfileSubScreen = new UserProfileSubscreenPM();&lt;/li&gt;&lt;li&gt;views = [ welcomeScreenPM, userProfilePM, userProfileSubScreenPM ];&lt;/li&gt;&lt;li&gt;}&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;}&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;c&quot;&gt;//base model class&lt;/span&gt;&lt;/li&gt;&lt;li&gt;[ArrayElementType(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;com.gc.BasePM&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;)]&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;r&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; views : &lt;span class=&quot;pt&quot;&gt;Array&lt;/span&gt;; &lt;span class=&quot;c&quot;&gt;//of BasePM&lt;/span&gt;&lt;/li&gt;&lt;li&gt;constructor() &lt;/li&gt;&lt;li&gt;{&lt;/li&gt;&lt;li&gt;initializeViews()&lt;/li&gt;&lt;li&gt;}&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;r&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; initializeViews() : &lt;span class=&quot;r&quot;&gt;void&lt;/span&gt; { &lt;span class=&quot;c&quot;&gt;//abstract }&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;r&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; _selectedView : BasePM;&lt;/li&gt;&lt;li&gt;[Bindable]&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;r&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;function&lt;/span&gt; get selectedView() : BasePM&lt;/li&gt;&lt;li&gt;{&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;r&quot;&gt;return&lt;/span&gt; _selectedView;&lt;/li&gt;&lt;li&gt;}&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;r&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;function&lt;/span&gt; set selectedView( value : BasePM ) : &lt;span class=&quot;r&quot;&gt;void&lt;/span&gt;&lt;/li&gt;&lt;li&gt;{&lt;/li&gt;&lt;li&gt;_selectedView = value;&lt;/li&gt;&lt;li&gt;dispatchEvent ( new Event( SELECTED_VIEW_CHANGED ) );&lt;/li&gt;&lt;li&gt;}&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;[Bindable(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;selectedViewChanged&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;)]&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;r&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;function&lt;/span&gt; get selectedViewIndex() : &lt;span class=&quot;r&quot;&gt;int&lt;/span&gt;&lt;/li&gt;&lt;li&gt;{&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;r&quot;&gt;return&lt;/span&gt; views.&lt;span class=&quot;fu&quot;&gt;indexOf&lt;/span&gt;( selectedView );&lt;/li&gt;&lt;li&gt;}&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;r&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;function&lt;/span&gt; set selectedViewIndex( value : &lt;span class=&quot;r&quot;&gt;int&lt;/span&gt; ) : &lt;span class=&quot;r&quot;&gt;void&lt;/span&gt;&lt;/li&gt;&lt;li&gt;{&lt;/li&gt;&lt;li&gt;selectedView = views[ value ];&lt;/li&gt;&lt;li&gt;}&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;/ol&gt;

&lt;p&gt;Now, pedant's amongst you are free to point out that I should put the sub view in the initializeviews of user profile, and that is true, and possible, and desirable - however, this is only an example of an alternative to indexes with constants - as always, please post improvements - and it probably wont compile straight off, I just hammered it out as text, I'm sure it reads clearly though :)&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://lifeonrails.org/">
    <author>
      <name>georgejcook</name>
    </author>
    <id>tag:lifeonrails.org,2008-10-26:3827</id>
    <published>2008-10-26T19:08:00Z</published>
    <updated>2008-10-26T19:13:28Z</updated>
    <category term="flex"/>
    <category term="dispatch"/>
    <category term="flex"/>
    <category term="models"/>
    <link href="http://lifeonrails.org/2008/10/26/bubbling-non-ui-events" rel="alternate" type="text/html"/>
    <title>bubbling non ui Events</title>
<content type="html">
            Really nice handy little tip this.

Say you have a model, which has a child model, and you want the child to bubble events to the parent (most common use I have for this is binding). I used to make an event listener on my parent, and then dispatch a new event for the child. There's a much better way of doing this..

simply set the eventhandling method to be dispatchEvent.. e.g.

myChild.addEventListener( AN_EVENT, dispatchEvent );

Clearly this assumes that your class (parent of myChild) extends/implements event dispatcher. It's soo obvious, I don't know how I missed it all this time!
          </content>  </entry>
  <entry xml:base="http://lifeonrails.org/">
    <author>
      <name>georgejcook</name>
    </author>
    <id>tag:lifeonrails.org,2008-08-11:2832</id>
    <published>2008-08-11T20:28:00Z</published>
    <updated>2008-08-11T20:53:29Z</updated>
    <category term="flex"/>
    <category term="rants and ideas"/>
    <category term="Agile"/>
    <category term="FlexUnit"/>
    <category term="TDD"/>
    <category term="Test Driven Development"/>
    <category term="Testrunner"/>
    <link href="http://lifeonrails.org/2008/8/11/tdd-or-not-tdd-that-is-the-question" rel="alternate" type="text/html"/>
    <title>TDD or not TDD, that is the question</title>
<content type="html">
            I've seen the light.
For so long I thought I was doing TDD, I thought I was being agile, and I hate to admit it, but I wasn't.
I was trying too hard. I was thinking too much, and secretly holding to fears and misconceptions that were stopping me from realising the benefits of some of the best agile practices.

I'm not hung up or bummed out though - it was fair enough really - the project's I was on didn't really allow for a truly agile approach for the majority of the time. The fact is you have to breathe out before you breathe in, and I was in a situation where there was no breathing space at all.

But I eventually did get some breathing space, and a neat reading list and as fate would have it, that coincided with one of those periods that we all get as software engineers, where you get real hungry. I'm not talking raid the fridge hungry, I'm talking knowledge hunger - process hunger, efficiency hunger.

I've been lapping up some great stuff and it made me see where I was going wrong in a lot of areas. The biggest one I came to realise was that I wasn't really doing TDD. 

I kept trying, but I'd always buy into THE OLD LIE. You know - &quot;it takes too long to write the test up front, I'll just nip back later&quot;. Recently though, I sat myself down after my latest book bout and had a word with myself.. what was stopping me from doing this?

It turns out it was actually something quite simple - it took so long for me to compile and run tests on the projects that I was in, that I had a skewed opinion of TDD. I was literally associating the amount of time it took to build and run a full testrunner (often times in excess of 800 tests) with TDD. In short I had been foolish.

I think it was the nazareen who said &quot;if thy eye offends thee, tear it out&quot;, which though seemingly grim, is actually good advice. And tear it out I did.

I basically came to a new understanding - this is it:
The testrunner is the total suite of tests for the entire application,
The testrunner is the docuemntation of the API's of the entire application,
The testrunner is ueful for regression,
The testrunner is useful when building to ensure the application is in a healthy state,
The testrunner actually is more and more depending on how many books you read, and how good your memory is.

One thing the testrunner is NOT however, is a harness for doing TDD.

This has been my single biggest leap in understanding of TDD. Quite simply the apps I work on are so big that building and running the entire testrunner in order to do TDD is simply unbearable.

On my last project some of us would sometimes remove all the tests from the testsuite, save 1 or 2 (remember, if thy eye offends thee - tear it out ;-) ). However, we never formalised this process - sometimes with disastourous consequences: You'd run the testrunner and find someone had deleted ALL of the tests in the app.. Looks like that build that went out might have only gone out with 1 out of 1,000 tests being run on it..

I can't believe how obvious the answer is.. I just made a new rig - TDDRunner.mxml, and a new testsuite AllTDDTests.as. It's really simple - each developer has their own AllTDDTests file which they keep the tests in that they need at any given time, and never check it in. 

I've been doing this for a week now and with great results. I'm genuinely able to do TDD without any painful overhead, waiting for the compiler, or other tests, or risking deleting the testuites, or without even losing concentration. It's a dream come true.

As I write the tests, I add them to the main testrunner, and I run this whenver I reach a mile stone (such as finishing a presentation model, or a domain model ) to ensure that regression is not caused elsehwere.

I cannot emphasize enough how great the benefits of this approach are. Myself and a couple of colleauges are literally buzzing off TDD as a result of this. It's also much easier to sell to others who are usually closed to it.

It's gone from barely being able to justify it to some colleagues to the point where they now have no excuse for not doing it.

Perhaps with other languages this isn't such a problem, but with actionscript, or I suspect with any app with a large testsuite, I suspect this simple process improvement will lead to more developers practising TDD.
          </content>  </entry>
  <entry xml:base="http://lifeonrails.org/">
    <author>
      <name>georgejcook</name>
    </author>
    <id>tag:lifeonrails.org,2008-07-28:2552</id>
    <published>2008-07-28T19:59:00Z</published>
    <updated>2008-08-11T20:03:44Z</updated>
    <category term="actionscript parser"/>
    <category term="eval"/>
    <category term="firebug"/>
    <category term="flex"/>
    <category term="flexspy"/>
    <link href="http://lifeonrails.org/2008/7/28/flexbug-well-sort-of" rel="alternate" type="text/html"/>
    <title>FlexBug.. well sort of</title>
<content type="html">
            &lt;p&gt;I&#8217;ve been a huuuge fan of firebug for sme time and longed for a version for flex. FlexSpy has been around for some time, and is really great, but it needed a bit more, especially in terms of invoking it. Currently it has this target button, but it&#8217;s a bit naff, and slow.. &lt;/p&gt;

&lt;p&gt;As such, I&#8217;ve taken some code I&#8217;ve posted about earlier, and some more code from the great Ralf Bokelberg - to create FlexBug.. it might be cheaky using this name, or indeed using the excellent flexspy code like this, but wtf afterall flexspy is released under the wtf license ;-) (check if u don&#8217;t believe me).&lt;/p&gt;

&lt;p&gt;The new changes allow you to right click on the stage and it will list a child hierarchy - selecting any element opens that element up in flexspy - making it easier to identify ui components and also quicker (no more parsging tons of xml inside the swf).&lt;/p&gt;

&lt;p&gt;I&#8217;ve also added FlexTrmp to this as well - which can allow you to execute rudimentary actionscript in real time.&lt;/p&gt;

&lt;p&gt;The parser is shite - sorry, it&#8217;s just a spike that I&#8217;ve never had time to improve, but still - there&#8217;s basic code completion, object inspection and code snippets.&lt;/p&gt;

&lt;p&gt;Further more - if you hold control while clicking on object&#8217;s that are in flexspy view (e.g. presentation models, or other classes) a variable will be created in the code console.&lt;/p&gt;

&lt;p&gt;why?&lt;/p&gt;

&lt;p&gt;The motivation is simple - I wanted a simple means of getting maximum use out of every build. I&#8217;ve worked on a cuple of projects now with huge build times, and I hated when something screwed up that stopped me verifying some functionality. Ok TDD theoreticaly prevents this, but we all know there are frequent exceptions to this, and moments when we wished we could hack about - especially when investigating defects, familiarising with new code or working on spike&#8217;s.&lt;/p&gt;

&lt;p&gt;I hope you find this combination of flexspy and the ContextMenuItemProvider and FlexTramp helpful. I&#8217;ve also included the excellent IsDeveloperVersionChecker, also from Ralf - if you look at the downloaded rig project you will be able to see it&#8217;s use - check the compiler args for more info.&lt;/p&gt;

&lt;p&gt;Please - no gripes about code etc.. as I said it was only a spike - if anyone seriously want&#8217;s to take this on and turn it into a proper open source project - well please let me know.&lt;/p&gt;

&lt;p&gt;For working example visit:&lt;/p&gt;

&lt;p&gt;for source code download this.
&lt;a href=&quot;http://www.lifeonrails.org/flexbugalpha.zip&quot;&gt;flexbugalpha download !&lt;/a&gt;+&lt;/p&gt;

&lt;p&gt;For more info on flextramp - see my flextramp blog post -it has syntax, etc..&lt;/p&gt;

&lt;p&gt;please note - I&#8217;m doing this off dial up speed internet (damn bt so much) - my connection is so slow that I can&#8217;t really upload working example&#8217;s etc yet - you&#8217;ll have to trust me and download the zip.&lt;/p&gt;

&lt;p&gt;once I got my broadband connection, I&#8217;ll upload proper examples and screenshots here..&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://lifeonrails.org/">
    <author>
      <name>georgejcook</name>
    </author>
    <id>tag:lifeonrails.org,2008-07-17:2438</id>
    <published>2008-07-17T12:31:00Z</published>
    <updated>2008-07-17T12:51:43Z</updated>
    <category term="flex"/>
    <category term="actionscript"/>
    <category term="animation"/>
    <category term="flex"/>
    <category term="jerky"/>
    <category term="text"/>
    <category term="zoom"/>
    <link href="http://lifeonrails.org/2008/7/17/animating-text-in-flex-solving-scaling-problems" rel="alternate" type="text/html"/>
    <title>Animating text in flex - solving scaling problems</title>
<content type="html">
            &lt;p&gt;I've been working on a project recently and made a pod component. There's a requirement which has the text animating on the pods as they scale up and down. However, we've been stuck because the text animation is jerky and jittery and looks wrong.&lt;/p&gt;

&lt;p&gt;There are lots of pages about this problem, and the solutions vary from making bitmap data copies (which look crap when they scale up), to using flash, to some random things involving font embedding tags.&lt;/p&gt;

&lt;p&gt;However,none of them work - but one of my colleagues stumbled upon the solution..&lt;/p&gt;

&lt;p&gt;Use this tag. fontGridFitType&lt;/p&gt;

&lt;p&gt;It's used like this:&lt;/p&gt;

&lt;p&gt;here's a snippet:&lt;/p&gt;

&lt;ol class=&quot;CodeRay&quot;&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;&amp;lt;?xml version=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;1.0&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; encoding=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;utf-8&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;?&amp;gt;&lt;/li&gt;&lt;li&gt;&amp;lt;mx:Application xmlns:mx=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;http://www.adobe.com/2006/mxml&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; layout=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;vertical&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&amp;gt;&lt;/li&gt;&lt;li&gt;  &amp;lt;mx:&lt;span class=&quot;pt&quot;&gt;Text&lt;/span&gt; id=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;jerky&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; text=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;some jerky text&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; /&amp;gt;&lt;/li&gt;&lt;li&gt;  &amp;lt;mx:&lt;span class=&quot;pt&quot;&gt;Text&lt;/span&gt; id=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;smooth&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; text=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;some smooth text&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; fontGridFitType=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;none&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;/&amp;gt;&lt;/li&gt;&lt;li&gt;  &lt;/li&gt;&lt;li&gt;  &amp;lt;mx:Zoom id=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;grow&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; targets=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;{ [ jerky, smooth ] }&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;/li&gt;&lt;li&gt;        zoomWidthTo=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; zoomHeightTo=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; duration=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;2000&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;/&amp;gt;  &lt;/li&gt;&lt;li&gt;  &amp;lt;mx:Zoom id=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;shrink&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; targets=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;{ [ jerky, smooth ] }&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;/li&gt;&lt;li&gt;        zoomWidthTo=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; zoomHeightTo=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; duration=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;2000&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;/&amp;gt;  &lt;/li&gt;&lt;li&gt;  &lt;/li&gt;&lt;li&gt;  &amp;lt;mx:&lt;span class=&quot;pt&quot;&gt;Button&lt;/span&gt; label=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;eat me&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; click=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;{ grow.play() }&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;/&amp;gt;&lt;/li&gt;&lt;li&gt;  &amp;lt;mx:&lt;span class=&quot;pt&quot;&gt;Button&lt;/span&gt; label=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;drink me&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; click=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;{ shrink.play() }&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;/&amp;gt;&lt;/li&gt;&lt;li&gt;&amp;lt;/mx:Application&amp;gt;&lt;/li&gt;&lt;li&gt;&lt;/li&gt;&lt;/ol&gt;

&lt;p&gt;The reason it works is beacuse if the fontGridtype is set to anything other than none , it plays with the kerning horrendously (making the letters land on pixelboundaries) - which makes it appear jerky.&lt;/p&gt;

&lt;p&gt;I was sOOO glad to find this out - it was driving me mad!!&lt;/p&gt;

&lt;p&gt;Have fun with it.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://lifeonrails.org/">
    <author>
      <name>georgejcook</name>
    </author>
    <id>tag:lifeonrails.org,2008-03-19:939</id>
    <published>2008-03-19T13:09:00Z</published>
    <updated>2008-03-19T13:19:27Z</updated>
    <category term="rants and ideas"/>
    <category term="tips"/>
    <category term="1and1"/>
    <category term="cancel contract"/>
    <category term="dedicated server"/>
    <category term="hosting"/>
    <link href="http://lifeonrails.org/2008/3/19/1and1-does-it-again-great-hosts" rel="alternate" type="text/html"/>
    <title>1and1 does it again, great hosts</title>
<content type="html">
            &lt;p&gt;Just a short note to say that I truly love the web hosts 1and1. That's who my server is hosted with, and who is responsible for hosting all of the sites I have.&lt;/p&gt;

&lt;p&gt;They have great dedicated server packages that are super fast, with loads of bandwidth. I actually run visualchat.co.uk on on of their dedicated servers, which has ample bandwidth for all the audio and video of the webcam chat sessions.&lt;/p&gt;

&lt;p&gt;In short,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the servers are fast,&lt;/li&gt;
&lt;li&gt;they got great control panels,&lt;/li&gt;
&lt;li&gt;the support is actually really good, both written, and on the phone,&lt;/li&gt;
&lt;li&gt;the bandwidth is phenomenal,&lt;/li&gt;
&lt;li&gt;you get free ftp backup with each dedicated server,&lt;/li&gt;
&lt;li&gt;they never go down.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They really are great - I strongly recommend them... However, I'm not writing because of that - I'm writing to let you know that they have exceeded my expectations again:&lt;/p&gt;

&lt;p&gt;In September 2007 I took up a new server package, a beefed up dedicated server, that came with 3 months free contract, then 18 months minimum term. Now, I was intending to migrate my existing dedicated server (contract expired) to the new server.&lt;/p&gt;

&lt;p&gt;However, I started working for Adobe, and was so busy that I never got a chance to move the server, and therefore ended up paying for both dedicated servers. Now 1and1 get a few bad reviews for locking people into contracts, but I have to say - they were great with me - I called them, explained what had happened, and they simply asked me to fax them the details.&lt;/p&gt;

&lt;p&gt;The server is now cancelled: Including the 18 month contract! Yep! they just let me back out of it, by being reasonable and human about it all - so next time someone tells you that they are monsters, and hold people in to contracts, I suggest you ask them how they spoke to their staff, and how they treated them - I know other people who have been rude, and they get what they give..&lt;/p&gt;

&lt;p&gt;I don't know any other host that would do this - I can definitely tell you 3 other hosts that wont budge at all on these matters (though I don't want to name them)... &lt;/p&gt;

&lt;p&gt;BTW, I'm not an affiliate - I haven't joined their program, so I'm genuinely objective - check them out if you want dedicated servers- for any small-medium scale project (read as, don't need a server farm and fail over), they're great!&lt;/p&gt;
          </content>  </entry>
</feed>
