Note that there are some explanatory texts on larger screens.

plurals
  1. POFlex List item renderer
    primarykey
    data
    text
    <p>I have created an item renderer spark list in flex , but i want to call a function on addition of new row in list and not afterwards. I am getting a data object in rendered list in it i am getting the type of data to be displayed in list ie. either text or image. So on addition of new data in list i want a function to be called up in rendered list that checks the type of data received and then it will either create and add an image element or a text element. So the main problem is how i get a function called on addition of data. I have tried events like datachange and added but they keep on calling the function over and over again when we scroll the list but i want the function to be called once only on addition of data and not after wards. Below is the renderer list code , maybe you will get a better idea of what i am trying to do:</p> <pre><code>&lt;s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" autoDrawBackground="true" dataChange="test_add()"&gt; &lt;fx:Script&gt; &lt;![CDATA[ import mx.controls.Alert; public function test_add() : void { Alert.show("type="+data.msg_type); if(data.msg_type=="text"){ //code to create and add new text element to list_row// } if(data.msg_type=="image"){ //code to create and add new image element to list_row// } } ]]&gt; &lt;/fx:Script&gt; &lt;s:Group id="list_row" width="100%" verticalAlign="middle" verticalCenter="0"&gt; &lt;/s:Group&gt; &lt;/s:ItemRenderer&gt; </code></pre> <p>Any help will be highly appreciated. Thanks</p>
    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. This table or related slice is empty.
    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