If your override is exactly as you posted:
override public function set data(value:Object):void { }

then the override never passed the value to the base class implementation so 
the value wasn't stored and the debugger will read from the "get data()" 
function and show you a null.

In the base class the setter does this:

                _data = value;

And the getter does this:

                return _data;

where _data is defined as:

private var _data:Object;

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of Tracy Spratt
Sent: Sunday, January 25, 2009 8:14 AM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Re: Explain "override public function"

I don't know the circumstances, but sometimes the framework passes a null to 
set data.  It is not uncommon to see a test for null in the override. I know 
that there are some "buffer" renderers created, perhaps they get a null?

Also to the OP, do you still need an answer to "Explain 'override public 
function'"?  It is basic OOP syntax, but I'll give it a few sentences if you 
need.

Tracy Spratt
Lariat Services

Flex development bandwidth available

________________________________
From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of Paul Andrews
Sent: Sunday, January 25, 2009 10:54 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Re: Explain "override public function"


----- Original Message -----
From: "Paul Andrews" <p...@ipauland.com<mailto:paul%40ipauland.com>>
To: <flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com>>
Sent: Sunday, January 25, 2009 10:44 AM
Subject: Re: [flexcoders] Re: Explain "override public function"

> ----- Original Message -----
> From: "malik_robinson" 
> <malik_robin...@yahoo.com<mailto:Malik_Robinson%40yahoo.com>>
> To: <flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com>>
> Sent: Sunday, January 25, 2009 5:44 AM
> Subject: [flexcoders] Re: Explain "override public function"
>
>
>>
>> Hi,
>>
>> That helps a bit. When I set a breakpoint after "override public
>> function set data(value:Object):void { } I get a value of null as if
>> nothing is there. So you say the list class sets the data property so
>> any idea what would cause it to be null for me? I am returning some XML
>> from the server and it works fine no problem, but I am just confused on
>> where to go look. My tree is pretty basic

I forgot to say - if your data attribute is null there's a problem with the
dataprovider.

Try using the default renderer if you still have trouble with yours. The
Tree control in the docs has an excellent example, so work your data into
that until you find the problem.

>>
>> <mx:Tree id="someId"
>> dataProvider="{myTree}"
>> itemRenderer="com.abc.views.renderers.MyRenderer"
>> labelField="@name" />
>>
>> I am confused on how and where the data gets automagically passed to
>> this Renderer.
>
> The tree controll will take the data from the data provider and set the
> data
> property of the item renderer as required when it is instantiated. It's
> not
> really something that you have to really consider. All your item renderer
> needs to know is that it has a data property and that is what it should
> use
> when rendering.
>
>> -Malik

snip

Reply via email to