Hi Manish; As always, your response was prompt and, even better, helpful!
Is it fair to say that the documentation included with Beta 1 is incorrect with respect to this procedure? The sample code I was working from can be found at Flex Help->Developing Flex Applications->Using Cell Renderers and Cell Editors->Overriding the dataObject property The procedure outlined here makes the implicit assumption that the child objects of an HBox have all been created at the time the dataObject setter is called. (It's also doing something else I think is weird. It only calls super.dataObject=value if value is not NULL. If the goal of the override is to supplement the base class's behaviour, not replace it, shouldn't this call always be made?) Thanks. Tobias. --- In flexcoders@yahoogroups.com, Manish Jethani <[EMAIL PROTECTED]> wrote: > > 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/