Read the itemrenderer posts on my blog (blogs.adobe.com/aharui).  Renderers get 
recycled and only enough renderers to display the visible items are created, so 
using creationCOmplete is rarely useful.

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of 
pedrocpedroc
Sent: Thursday, September 18, 2008 10:24 AM
To: [email protected]
Subject: [flexcoders] Trying to refine inline itemrenderer prompt to state 
based image loading


Hi,

Here is the component with the inline item renderer:

<local:Component >

<local:itemRenderer>
<mx:Component> <local:imageRend
creationComplete="outerDocument.loadFirstEleven(event.currentTarget);"
click="outerDocument.inView(event.currentTarget);"/>
</mx:Component>
</local:itemRenderer>

</local:Component>

Here is the creationComplete triggered function:

var count55:int=0

public function loadFirstEleven(targetObj:Object):void{

var target:imageRend = (targetObj as imageRend);

if( count55 < Math.min(12, model.subscriptions.length ) ){

target.currentState = "loading_thumbnail";
count55++;
}
}

Which, as expected, changes the state in the first lot of target objects.

(Changing the state prompts imageRend to start retrieving related
images, and 'loaded' swaps out a placer image with the required one.)

So far so good, but what I really want to do is load up the first few
images, and then react to user clicks (hence the 'inView' reference)
to load up further images i.e. 13 onwards.

I have tried traversing, using the objects parent property, and then
getChildAt/getChildIndex combinations, as a basis for finding the
current position + 12, but I am just guessing and its getting me nowhere.

Thanks for any help in advance.

Reply via email to