If I am understanding correctly, I'd say that is way too complex
behavior to cram into an in-line renderer.  Perhaps someone else will be
able to give you a simple solution, but...

 

Build a full renderer class that overrides set data() and uses
invalidation with commit Properties() and updateDisplayList().  If you
are an item renderer component lifecycle expert, you can start from
scratch, otherwise, *find an example*.

 

Any data that affects the row/item-level state you will need to store in
the dataProvider, or elsewhere.  For example, the start index of your
image list.  The set data function must cause that index value to be
retreived from wherever you stored it, and then use invalidation to
ensure that the "load next 11" functionality gets called using that
index.

 

All this is necessary because renderers are recycled.  This mean
creationComplete only fires once, and anything not set using the above
data/invalidation mechanism will randomly display when you scroll.

 

Tracy

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of pedrocpedroc
Sent: Thursday, September 18, 2008 1:24 PM
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