Because creationComplete fires only once, when the component is created, but
item renderers are recycled (google or search for that for more detail).

 

You cannot do any work that depends on the current row (dataProvider item)
in a creationComplete handler.

 

You must override the set data() function and do the work there.  Actually,
you should store any necessary values in set data(), call
invalidateProperties(), then do the work in a commitProperties override.

 

Item renderers are a bit tricky.  I advise you do not try to start from
scratch, but rather find an example (there are many) and modify it to meet
your needs.

 

Tracy Spratt,

Lariat Services, development services available

  _____  

From: [email protected] [mailto:[email protected]] On
Behalf Of criptopus
Sent: Sunday, December 13, 2009 1:46 PM
To: [email protected]
Subject: [SPAM] [flexcoders] itemRenderers, DataGrids & Scroll Bars
Madness!!!

 

  

Why does this work as an itemRenderer....

<?xml version="1.0" encoding="utf-8"?>
<mx:HBox xmlns:mx="http://www.adobe. <http://www.adobe.com/2006/mxml>
com/2006/mxml" width="100" height="62">

<mx:Image source="{'media/00000' + data.medid + '+' + data.medbody}"
width="100%" height="100%"/>

</mx:HBox>

And why does this not work ....

<?xml version="1.0" encoding="utf-8"?>
<mx:HBox xmlns:mx="http://www.adobe. <http://www.adobe.com/2006/mxml>
com/2006/mxml" width="100" height="62" creationComplete="init();">

<mx:Script>
<![CDATA[

[Bindable]
private var myPict:String;

private function init():void
{
myPict='media/00000' + data.medid + '+' + data.medbody;
}

]]>
</mx:Script>

<mx:Image source="{myPict}" width="100%" height="100%"/>

</mx:HBox>

.... Its driving me loopy, both displays pictures in the dataGrid on start
up, but the second one goes hay wire and displays the wrong pictures when
you scroll. Its just madness!!!

- Stephen



Reply via email to