On 2/8/06, tobiaspatton <[EMAIL PROTECTED]> wrote:

>                 override public function set dataObject
> (value:Object):void
>                 {
>                                 super.dataObject = value;
>                                 trace( value.image, image);
>
>                                 if( image != null )
>                                 {
>                                         image.source = value.image;
>                                 }
>                 }

[snip]
> From the output we can see that the dataObject setter function is
> being called once when the image parameter is a real value, but for
> all subsequent calls, the image parameter is null.
>
> Why would this be? It's hard to set the source parameter of null.

Child objects are created in the component's "createChildren" method,
which is called only when the component is added to the display list -
which, in the case of cell renderers, is after their "dataObject"
property is set.  Property setters should be coded to assume that
child objects have not been created.  This is what I'd do:

 function set dataObject(value)
 {
   super.dataObject = value;
   invalidateDisplayList();
 }

 function updateDisplayList()
 {
  image.source = value.image;
 }

It's also more efficient if you set the image's source in updateDisplayList.


--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to