Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Not sure about flex 4 as i mostly work in flex 3 but the set up should be close.<br/> Basically, let the render handle the rendering.<br/></p> <p>Your list should look something like this. </p> <p>There are 3 very important overrides you can do that will control the way a renderer can react to data.<br/> 1) set data is for when new data is assigned<br/> 2) createChildren will allow you to dynamically create children. I believe this is the function you are looking for in conjunction with set data<br/> 3) commitProperties this is where you do you assigning data to the children that are hard coded like my label example or the dynamically created children.<br/> <br/> What I have done in the past is similar.<br/> I test the data agains the current layout if it isn't the correct layout I rebuild it.<br/> So in set data method I test if layout is wrong I call createChildren().<br/> I suppose you could test the data structure on the old data before calling super.data in set data, but I didn't have good results like that.<br/></p> <p>myRenderer.mxml</p> <pre><code>&lt;mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" &gt; &lt;mx:Script&gt; &lt;![CDATA[ override public function set data(val:Object):void{ super.data = val; if( !val ){ return; } // test data here if current layout is wrong rebuild it by calling createchildren } override protected function createChildren():void{ super.createChildren() if( this.data == null ){ return; } // create your data driven layout here } override protected function commitProperties():void{ super.commitProperties(); if ( data == null ){ return; } } ]]&gt; &lt;/mx:Script&gt; &lt;mx:Label id="myLabel" text="{data.someLabelVar} /&gt; &lt;/mx:VBox&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

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

Reload