Dispatched event when a LONG list of custom item renderers has completely rendered?


i have custom <s:list> component:

 

<local:thumbnaillist id="list" top="0" bottom="0" left="0" right="0" dataprovider="{imagefiles}"  allowmultipleselection="true" dragenabled="true" dragmoveenabled="true" />


that extends sparks list , uses itemrendererfunction create custom itemrenderer:

 

public class thumbnaillist extends list
{

     public function thumbnaillist()
     {
          super();
          itemrendererfunction = getitemrenderer;

     }

 

     protected function getitemrenderer( data : object ):classfactory
     {
          var clz : class = defaultitemrenderer;

          clz = thumbnailrendererimpl;

          // *** not work: cannot add event listener itemrenderer

          // clz.addeventlistener( "rendercomplete", function complete ( event : event ) : void { alert.show ('render complete...'); } );
          return new classfactory(clz);
     }

 

}

 

and custom itemrenderer:

 

<?xml version="1.0" encoding="utf-8"?>
<s:itemrenderer datachange="datachangehandler(event)" xmlns:fx="http://ns.adobe.com/mxml/2009"
     xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:s="library://ns.adobe.com/flex/spark" >

 

     <fx:script>
     <![cdata

     protected function datachangehandler(event:flexevent): void  {
          img.soruce = data string;

     }

     private function loadcomplete( event : event ) : void  {
          dispatchevent( new event( "rendercomplete" ) );
     }
     ]]>
    </fx:script>
    <s:graphic>
        <s:group id="group" >
            <s:layout><s:horizontallayout /></s:layout>
            <mx:image id="img" horizontalcenter="0" verticalcenter="0" complete="loadcomplete(event);" />   
        </s:group>
    </s:graphic>
</s:itemrenderer>

 

the dataprovider list large , thumbnails being created large... means

the list takes long time render completely.  once list rendered, functions nicely.  since it

takes long time render, want add popup or progress bar show user list being rendered.  so,

my question:  there way tell when all custom thumbnail renderers have finished loading respective

image data?

 

i have tried can think of, , unable move forward on project until find resolution.

 

thanks!

you can compare number of events dispatched length of dataprovider.

 

 

this included in custom list component dispatch progress events , final complete event...

 

or

you handle of outside list component in app.  set events bubble itemrenderer , out

 

dispatchevent( new event( "rendercomplete", true ) );


More discussions in Flex (Read Only)


adobe

Comments

Popular posts from this blog

CS5 Adobe Media Encoder: Encode failed because the source duration is nil.

cf_sql_integer vs cf_sql_bigint vs cf_sql_int??

localhost/joomla15/administrator doesnt work - Joomla! Forum - community, help and support