<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" 
      xmlns:thr="http://purl.org/syndication/thread/1.0">
  <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/05/flex-4-custom-layouts.html" />
  <link rel="self" type="application/atom+xml" href="http://www.insideria.com/atom.xml" />
  <id>tag:www.insideria.com,2009://34/tag:www.insideria.com,2009://34.36291-</id>
  <updated>2009-11-21T02:54:49Z</updated>
  <title>Comments for Flex 4 &amp; Custom Layouts (http://www.insideria.com/2009/05/flex-4-custom-layouts.html)</title>
  <generator uri="http://www.sixapart.com/movabletype/">Movable Type 4.21-en</generator>
  <entry>
    <id>tag:www.insideria.com,2009://34.36291</id>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/05/flex-4-custom-layouts.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://blogs.oreilly.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=34/entry_id=36291" title="Flex 4 &amp; Custom Layouts" />
    <published>2009-05-21T00:55:37Z</published>
    <updated>2009-05-21T00:55:37Z</updated>
    <title>Flex 4 &amp; Custom Layouts</title>
    <summary>If you haven&apos;t been keeping up with the latest on Flex 4, this is something that you will certainly want to look into.   One of the new features of the Flex 4/Spark component architecture is that you can customize the layout of a container without altering the container itself.   All you need to do is define a custom layout.     Read more to see how...</summary>
    <author>
      <name>Andrew Trice</name>
      
    </author>
    
    <category term="Blogs" />
    
    <content type="html" xml:lang="en" xml:base="http://www.insideria.com/">
      <![CDATA[If you haven't been keeping up with the latest on Flex 4, this is something that you will certainly want to look into.   One of the new features of the Flex 4/Spark component architecture is that you can customize the layout of a container without altering the container itself.   All you need to do is define a custom layout.     

<br/><br/>

Containers in the Flex 4/Spark architecture do not control their own layout.  Instead, each has a layout property that determines how the children are laid out onscreen.   You can have a single Group container, and give it a vertical layout, horizontal layout, or a tile layout, depending how you've built it.   It is as simple as:

<br/><br/>
<div class="acode" style="overflow: auto; padding: 10px;" ><div style="overflow-x: visible;"> 
<code language="perl">
<pre>
&lt;s:layout&gt;
	&lt;s:VerticalLayout/&gt;
&lt;/s:layout&gt;</pre>
</code>
 
</div></div> 

But what is really cool is that you are not just limited to the default layouts that are defined in the framework.  You can easily customize the BaseLayout class to implement your own custom layout logic.  Below is a simple example showing how to do a layout of clockwise placement of components around the origin.  Just click on the button in the lower left to add more buttons to the layout.

<iframe src="http://www.tricedesigns.com/portfolio/flex4layouts/" frameborder="0" width="100%" height="350"></iframe>

<br/><br/>
Below is the code for the main application file.  As you can see, it's pretty simple.  This is just a DataGroup, which is something like a repeater, that contains a series of buttons.   The layout of the container is based on a custom layout implementation.    On creationComplete, the data provider for the DataGroup is populated, which creates button instances in the layout.

<br/><br/>
<div class="acode" style="overflow: auto; padding: 10px;" ><div style="overflow-x: visible;"> 
<code language="perl">
<pre>
&lt;?xml <span class="category2">version</span>="<span class="quote">1.0</span>" encoding="<span class="quote">utf-8</span>"?&gt;
&lt;s:<span class="category2">Application</span> 
  xmlns:fx="<span class="quote">http://ns.adobe.com/mxml/2009</span>" 
  xmlns:s="<span class="quote">library://ns.adobe.com/flex/spark</span>" 
  xmlns:mx="<span class="quote">library://ns.adobe.com/flex/halo</span>"
  xmlns:local="<span class="quote">*</span>"&gt;
  
  &lt;s:creationComplete&gt;
    &lt;![CDATA[
      <span class="category1">for</span> ( <span class="category1">var</span> <span class="category2">x</span>:<span class="category1">int</span> = 0; <span class="category2">x</span> &lt; 10; <span class="category2">x</span>++ ){
         dataSource.<span class="category2">addItem</span>( dataSource.<span class="category2">length</span> );
       }
    ]]&gt;
  &lt;/s:creationComplete&gt;
  
  &lt;fx:Declarations&gt;
    &lt;mx:ArrayCollection id="<span class="quote">dataSource</span>" /&gt;
  &lt;/fx:Declarations&gt;
  
  &lt;s:DataGroup 
    <span class="category2">width</span>="<span class="quote">100%</span>" <span class="category2">height</span>="<span class="quote">100%</span>"
    dataProvider="<span class="quote">{ dataSource }</span>"
    itemRenderer="<span class="quote">SimpleItemRenderer</span>"&gt;
    
    &lt;s:layout&gt;
      &lt;local:CircularLayout /&gt;
    &lt;/s:layout&gt;
  
  &lt;/s:DataGroup&gt;
  
  &lt;mx:<span class="category2">Button</span> 
    left="<span class="quote">5</span>" bottom="<span class="quote">5</span>"
    <span class="category1">label</span>="<span class="quote">Click to Add a Button</span>"
    click="<span class="quote">dataSource.addItem( dataSource.length )</span>" /&gt;
  
&lt;/s:<span class="category2">Application</span>&gt;</pre>
</code>
 
</div></div> 

You can see that the layout for the DataGroup instance is controlled by the CircularLayout class, which is shown below.  In this class, it just loops over the children of  the datagroup object and places them clockwise in a circle.   I looked at the source of the VerticalLayout class to figure out how it worked, and from there I was able to start building my own layout implementation.

<br/><br/>
<div class="acode" style="overflow: auto; padding: 10px;" ><div style="overflow-x: visible;"> 
<code language="perl">
<pre>
package 
{
   <span class="category1">import</span> mx.core.ILayoutElement;
   
   <span class="category1">import</span> spark.layouts.supportClasses.LayoutBase;
   
   <span class="category1">public</span> <span class="category1">class</span> CircularLayout <span class="category1">extends</span> LayoutBase
   {
      override <span class="category1">public</span> <span class="category1">function</span> updateDisplayList(w:<span class="category2">Number</span>, h:<span class="category2">Number</span>):<span class="category1">void</span>
      {
           <span class="category1">super</span>.updateDisplayList(w, h);
             
           <span class="category1">if</span> (!<span class="category2">target</span>)
             <span class="category1">return</span>;
                 
           <span class="category1">var</span> layoutElement:ILayoutElement;
           <span class="category1">var</span> count:uint = <span class="category2">target</span>.numElements;
             
           <span class="category1">var</span> angle : <span class="category2">Number</span> = 360/count;
           <span class="category1">var</span> radius : <span class="category2">Number</span> = <span class="category2">Math</span>.<span class="category2">min</span>( <span class="category2">target</span>.<span class="category2">width</span>/2, <span class="category2">target</span>.<span class="category2">height</span>/2 ) - 25;
             
           <span class="category1">var</span> w2 : <span class="category2">Number</span> = <span class="category2">target</span>.<span class="category2">width</span>/2;
           <span class="category1">var</span> h2 : <span class="category2">Number</span> = <span class="category2">target</span>.<span class="category2">height</span>/2;
             
           <span class="category1">for</span> (<span class="category1">var</span> i:<span class="category1">int</span> = 0; i &lt; count; i++)
           {
              layoutElement = <span class="category2">target</span>.getElementAt(i);
                    
              <span class="category1">if</span> (!layoutElement || !layoutElement.includeInLayout)
                <span class="category1">continue</span>;
            
              <span class="category1">var</span> radAngle : <span class="category2">Number</span> = (angle * i) * (<span class="category2">Math</span>.<span class="category2">PI</span> / 180) ;
            
              <span class="category1">var</span> <span class="category3">_x</span> : <span class="category2">Number</span> = <span class="category2">Math</span>.<span class="category2">sin</span>( radAngle );
              <span class="category1">var</span> <span class="category3">_y</span> : <span class="category2">Number</span> = - <span class="category2">Math</span>.<span class="category2">cos</span>( radAngle );
            
              layoutElement.setLayoutBoundsPosition( w2 + (<span class="category3">_x</span> * radius) - 25, h2 + (<span class="category3">_y</span> * radius) - 10 );
            } 
       }
    }
}</pre>
</code>
 
</div></div> 


And the item renderer used in this example is really basic.   It's just an ItemRenderer instance that contains a Button... plain, simple, and easy to see what's going on.

<br/><br/>
<div class="acode" style="overflow: auto; padding: 10px;" ><div style="overflow-x: visible;"> 
<code language="perl">
<pre>
&lt;s:ItemRenderer 
  xmlns:fx="<span class="quote">http://ns.adobe.com/mxml/2009</span>" 
  xmlns:s="<span class="quote">library://ns.adobe.com/flex/spark</span>" 
  xmlns:mx="<span class="quote">library://ns.adobe.com/flex/halo</span>"&gt;
  
  &lt;s:states&gt;
    &lt;s:State <span class="category2">name</span>="<span class="quote">normal</span>"/&gt;
    &lt;s:State <span class="category2">name</span>="<span class="quote">hovered</span>"/&gt;
  &lt;/s:states&gt;
  
  &lt;s:layout&gt;
    &lt;s:BasicLayout/&gt;
  &lt;/s:layout&gt;
  
  &lt;s:<span class="category2">Button</span> <span class="category1">label</span>="<span class="quote">{ data }</span>" baseColor.hovered="<span class="quote">#FF0000</span>" /&gt;
  
&lt;/s:ItemRenderer&gt;</pre>
</code>
 
</div></div> 

This example was created using the 4.0.0.7052 nighly build available from 
<a target="_blank" href="http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4">http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4</a>
<br/><br/>


___________________________________<br/>
<strong>Andrew Trice</strong><br/>
Principal Architect<br/>
<a href="http://www.cynergysystems.com" target="_blank">Cynergy Systems<br/>
http://www.cynergysystems.com</a>]]>
      
    </content>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2009://34.36291-comment:2060063</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2009://34.36291" type="text/html" href="http://www.insideria.com/2009/05/flex-4-custom-layouts.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/05/flex-4-custom-layouts.html#comment-2060063" />
    <title>Comment from John C. Bland II on 2009-05-20</title>
    <author>
        <name>John C. Bland II</name>
        <uri>http://Http://www.johncblandii.com</uri>
    </author>
    <content type="html" xml:lang="en" xml:base="http://Http://www.johncblandii.com">
        <![CDATA[<p>So sexy!!</p>]]>
    </content>
    <published>2009-05-21T03:20:53Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2009://34.36291-comment:2060064</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2009://34.36291" type="text/html" href="http://www.insideria.com/2009/05/flex-4-custom-layouts.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/05/flex-4-custom-layouts.html#comment-2060064" />
    <title>Comment from Bromley John on 2009-05-20</title>
    <author>
        <name>Bromley John</name>
        <uri></uri>
    </author>
    <content type="html" xml:lang="en" xml:base="">
        <![CDATA[<p>Nice sample. Very clean and easy. Thanks.</p>]]>
    </content>
    <published>2009-05-21T04:23:30Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2009://34.36291-comment:2060065</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2009://34.36291" type="text/html" href="http://www.insideria.com/2009/05/flex-4-custom-layouts.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/05/flex-4-custom-layouts.html#comment-2060065" />
    <title>Comment from Raul Riera on 2009-05-20</title>
    <author>
        <name>Raul Riera</name>
        <uri>http://www.hipervinculo.net</uri>
    </author>
    <content type="html" xml:lang="en" xml:base="http://www.hipervinculo.net">
        <![CDATA[<p>I have been looking at these examples for a while, but where do I get those libraries? They dont seem to come with Gumbo</p>]]>
    </content>
    <published>2009-05-21T04:26:52Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2009://34.36291-comment:2060067</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2009://34.36291" type="text/html" href="http://www.insideria.com/2009/05/flex-4-custom-layouts.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/05/flex-4-custom-layouts.html#comment-2060067" />
    <title>Comment from Erik on 2009-05-20</title>
    <author>
        <name>Erik</name>
        <uri></uri>
    </author>
    <content type="html" xml:lang="en" xml:base="">
        <![CDATA[<p>If you add 300 buttons you get a really nice shape :)</p>]]>
    </content>
    <published>2009-05-21T06:30:43Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2009://34.36291-comment:2060082</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2009://34.36291" type="text/html" href="http://www.insideria.com/2009/05/flex-4-custom-layouts.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/05/flex-4-custom-layouts.html#comment-2060082" />
    <title>Comment from glenn on 2009-05-21</title>
    <author>
        <name>glenn</name>
        <uri></uri>
    </author>
    <content type="html" xml:lang="en" xml:base="">
        <![CDATA[<p>ERIC - thats so funny, I did just that before scrolling down to see your comment. nice to know i'm not the only saddo out there ;-)</p>

<p>glenn<br />
tinylion</p>]]>
    </content>
    <published>2009-05-21T11:32:49Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2009://34.36291-comment:2060107</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2009://34.36291" type="text/html" href="http://www.insideria.com/2009/05/flex-4-custom-layouts.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/05/flex-4-custom-layouts.html#comment-2060107" />
    <title>Comment from Sekhar Ravinutala on 2009-05-21</title>
    <author>
        <name>Sekhar Ravinutala</name>
        <uri>http://www.allurefx.com</uri>
    </author>
    <content type="html" xml:lang="en" xml:base="http://www.allurefx.com">
        <![CDATA[<p>Neat example, thanks. Can't wait to start playing with 4.</p>]]>
    </content>
    <published>2009-05-21T17:44:17Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2009://34.36291-comment:2061801</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2009://34.36291" type="text/html" href="http://www.insideria.com/2009/05/flex-4-custom-layouts.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/05/flex-4-custom-layouts.html#comment-2061801" />
    <title>Comment from Chucky on 2009-06-04</title>
    <author>
        <name>Chucky</name>
        <uri></uri>
    </author>
    <content type="html" xml:lang="en" xml:base="">
        <![CDATA[<p>Thanks for this demo, but the real problem comes when you want to change the Z value of the element, as you better than me know, GroupBase doesn't have x, y, z, properties, you change x and y properties trough the setLayoutBoundsPosition method that only accepts the x and y property.. Could you help me out with this?</p>

<p>Thanks for the blog!:D</p>]]>
    </content>
    <published>2009-06-05T03:43:42Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2009://34.36291-comment:2061814</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2009://34.36291" type="text/html" href="http://www.insideria.com/2009/05/flex-4-custom-layouts.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/05/flex-4-custom-layouts.html#comment-2061814" />
    <title>Comment from Andrew Trice on 2009-06-05</title>
    <author>
        <name>Andrew Trice</name>
        <uri>http://www.tricedesigns.com</uri>
    </author>
    <content type="html" xml:lang="en" xml:base="http://www.tricedesigns.com">
        <![CDATA[<p>I think you can either use setChildIndex or swapChildren on the GroupBase to swap depths, however I haven't tested this out myself.</p>]]>
    </content>
    <published>2009-06-05T13:11:47Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2009://34.36291-comment:2061818</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2009://34.36291" type="text/html" href="http://www.insideria.com/2009/05/flex-4-custom-layouts.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/05/flex-4-custom-layouts.html#comment-2061818" />
    <title>Comment from Chucky on 2009-06-05</title>
    <author>
        <name>Chucky</name>
        <uri></uri>
    </author>
    <content type="html" xml:lang="en" xml:base="">
        <![CDATA[<p>@Andrew Trice<br />
but how can i change the child index if it's not a Child but instead it is and Element? If I try setChildIndex I get an error and this would only work fine if i just want to change the zindex of the child, but the true is that i want to create one 3D layout!</p>]]>
    </content>
    <published>2009-06-05T15:22:21Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2009://34.36291-comment:2061819</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2009://34.36291" type="text/html" href="http://www.insideria.com/2009/05/flex-4-custom-layouts.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/05/flex-4-custom-layouts.html#comment-2061819" />
    <title>Comment from Andrew Trice on 2009-06-05</title>
    <author>
        <name>Andrew Trice</name>
        <uri>http://www.tricedesigns.com</uri>
    </author>
    <content type="html" xml:lang="en" xml:base="http://www.tricedesigns.com">
        <![CDATA[<p>You can't set the depth of objects that are not on the display list, nor would you want to.   You only should manage depths on objects that are children of the GroupBase, not elements of the GroupBase.  </p>

<p>Elements that are accessed by getElementAt are not necessarily children on the display list, they are just elements that can be laid out within the GroupBase.   Children are accessed by getChildAt, and are actually on the display list.</p>

<p>This way, you can build layouts that support data virtualization, and scale to support very large data providers, without decreasing application performance.</p>

<p>If you are building a 3d layout, i would loop over the elements to determine what should be placed on screen, then loop over the children and set depths appropriately.   It's hard to give any more detail without knowing what you are doing.</p>]]>
    </content>
    <published>2009-06-05T15:32:29Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2009://34.36291-comment:2061825</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2009://34.36291" type="text/html" href="http://www.insideria.com/2009/05/flex-4-custom-layouts.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/05/flex-4-custom-layouts.html#comment-2061825" />
    <title>Comment from Chucky on 2009-06-05</title>
    <author>
        <name>Chucky</name>
        <uri></uri>
    </author>
    <content type="html" xml:lang="en" xml:base="">
        <![CDATA[<p>I see!! I really have to learn better the framework! So let's see, with this code:<br />
override public function updateDisplayList(w:Number, h:Number):void<br />
{<br />
var child:DisplayObject;<br />
var count:uint = target.numElements;<br />
for (var i:int = 0; i 
{<br />
			   	 if(target.getChildAt(i) is DisplayObject)<br />
			   	 {<br />
			   	 	child = target.getChildAt(i);<br />
			   	 	trace(child);<br />
			   	 }<br />
}<br />
I have access to the display objects that are children of the group? is it correct?</p>]]>
    </content>
    <published>2009-06-05T16:18:29Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2009://34.36291-comment:2061826</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2009://34.36291" type="text/html" href="http://www.insideria.com/2009/05/flex-4-custom-layouts.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/05/flex-4-custom-layouts.html#comment-2061826" />
    <title>Comment from Andrew Trice on 2009-06-05</title>
    <author>
        <name>Andrew Trice</name>
        <uri>http://www.tricedesigns.com</uri>
    </author>
    <content type="html" xml:lang="en" xml:base="http://www.tricedesigns.com">
        <![CDATA[<p>Be careful, there is target.numElements, which is the number of elements that could be renderered (same as the # of items in your data provider), and there is target.numChildren, which is all children that are on the display list.   To loop over all children, I think you want var count:uint = target.numChildren;</p>

<p>Take a look at the source of the HorizontalLayout class inside of the Flex framework to get an idea how Adobe is doing it internally.</p>]]>
    </content>
    <published>2009-06-05T16:25:43Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2009://34.36291-comment:2061828</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2009://34.36291" type="text/html" href="http://www.insideria.com/2009/05/flex-4-custom-layouts.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/05/flex-4-custom-layouts.html#comment-2061828" />
    <title>Comment from Chucky on 2009-06-05</title>
    <author>
        <name>Chucky</name>
        <uri></uri>
    </author>
    <content type="html" xml:lang="en" xml:base="">
        <![CDATA[<p>ups, you're right -.-' i was copying / pasting the code from flash builder and didn't changed that! I'm getting something now and this is what I've being looking for! Thanks a lot for the help!!Seriously, thanks!!</p>]]>
    </content>
    <published>2009-06-05T16:43:59Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2009://34.36291-comment:2061854</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2009://34.36291" type="text/html" href="http://www.insideria.com/2009/05/flex-4-custom-layouts.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/05/flex-4-custom-layouts.html#comment-2061854" />
    <title>Comment from Ely Greenfield on 2009-06-05</title>
    <author>
        <name>Ely Greenfield</name>
        <uri>http://www.quietlyscheming.com/</uri>
    </author>
    <content type="html" xml:lang="en" xml:base="http://www.quietlyscheming.com/">
        <![CDATA[<p><br />
@Chucky, @Andrew --  Andrew is right that in flex 4, you use the xxxElement APIs instead of xxxChild APIs. However, layouts shouldn't mess with the element order of the layout elements...that's under the control of the client code, and shouldn't be modified by the layout.</p>

<p>However, to do advanced layout, there a few additional features you might want to take advantage of:</p>

<p>1) every element has a depth property, which controls the layering of the elements on screen, independent of their order within their parent.  Some layouts will modify this property to get proper layering.</p>

<p>2) while most layouts simply use the new layout functions to set the bounds and size of the element post transform, more advanced layouts will want complete control over the transformation of the elements.  In this case, you can call setLayoutBounds, passing false for the postTransformation flag, and then call setLayoutMatrix to have finegrained control over 2D and 3D rotation, scale, and position.</p>

<p>Go to town...great to see everyone reallying digging in to this stuff.</p>

<p>Ely Greenfield.<br />
Adobe, Flex SDK.<br />
</p>]]>
    </content>
    <published>2009-06-06T01:09:16Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2009://34.36291-comment:2061900</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2009://34.36291" type="text/html" href="http://www.insideria.com/2009/05/flex-4-custom-layouts.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/05/flex-4-custom-layouts.html#comment-2061900" />
    <title>Comment from Andrew Trice on 2009-06-07</title>
    <author>
        <name>Andrew Trice</name>
        <uri>http://www.tricedesigns.com</uri>
    </author>
    <content type="html" xml:lang="en" xml:base="http://www.tricedesigns.com">
        <![CDATA[<p>Thanks for the clarification Ely.   I thought I remember seeing a "setDepth" function in earlier nightly builds.  Since I didn't see it in the current codebase, I missed the "depth" property and incorrectly assumed it was back to setChildIndex.  I'll have to dig into these some more myself.</p>]]>
    </content>
    <published>2009-06-07T17:05:20Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2009://34.36291-comment:2067291</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2009://34.36291" type="text/html" href="http://www.insideria.com/2009/05/flex-4-custom-layouts.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/05/flex-4-custom-layouts.html#comment-2067291" />
    <title>Comment from Anonymous on 2009-06-26</title>
    <author>
        <name>Anonymous</name>
        <uri></uri>
    </author>
    <content type="html" xml:lang="en" xml:base="">
        <![CDATA[<p>Ely's comments suggests there should be a "depth" property on ILayoutElements ?. I cant find that anywhere.</p>

<p>Is there some other way to change their z-order?</p>]]>
    </content>
    <published>2009-06-27T04:27:08Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2009://34.36291-comment:2139757</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2009://34.36291" type="text/html" href="http://www.insideria.com/2009/05/flex-4-custom-layouts.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/05/flex-4-custom-layouts.html#comment-2139757" />
    <title>Comment from Dilip on 2009-10-14</title>
    <author>
        <name>Dilip</name>
        <uri></uri>
    </author>
    <content type="html" xml:lang="en" xml:base="">
        <![CDATA[<p>Great example!</p>

<p>I have one question though... how to invoke updateDisplayList method in the custom layout?</p>

<p>I've a group of buttons that get placed in a SkinnableDataContainer with the help of a custom layout class as follows:</p>

<p>
    dataProvider="{appModel.myButtons}"<br />
    width="{DIAPLAY_WIDTH}" height="{BUTTON_HEIGHT+4}"<br />
    skinClass="view.skins.ContainerSkin"<br />
    itemRenderer="view.renderer.MyButtonRenderer"<br />
    click="startPointAreaClickHandler(event)"<br />
    mouseMove="areaMouseMoveHandler(event)"<br />
    mouseUp="areaMouseUpHandler(event)"<br />
    rollOut="areaMouseOutHandler(event)"<br />
    ><br />
    <br />
        <br />
    <br />
</p>

<p>myButtons is an ArrayCollection of VOs and VO has x and y coordinates as fields. Values of x and y determine the location of the button. When I add an object to myButtons, the application behaves as expected (adds a button in buttonsContainer at specified x and y coordinate). But when I just change values of x and y of an existing button, the buttons don't get repositioned. I have tried calling invalidateDisplayList on buttonsContainer but that doesn't trigger updateDisplayList method in the custom layout ButtonsLayout.</p>

<p>How do I trigger updateDisplayList method in the custom layout so that the button positions get updated whenever an event changes values of x and y of a button?</p>

<p>Any help is very much appreciated.</p>]]>
    </content>
    <published>2009-10-14T16:33:54Z</published>
  </entry>

</feed
