I don't work with datagrids so I'm not sure where the variable data comes
from.  My only guess is that the initialize event is being thrown too early
and that data hasn't been set yet.  Try using another event like
creationComplete or an event of the parent object.

- Dan


On 12/20/06, securenetfreedom <[EMAIL PROTECTED]> wrote:

  I have a component comprised of a mx:Text field that is rendered in a
datagrid. I am trying to access the data.name and the data.descr of
the data that is bound to the component so that I can use both in one
mx:Text field and not two.

If I access them separately like this it works fine:
<mx:Text id="title_txt" text="{data.name}"
fontWeight="bold" fontSize="10" paddingBottom="0" />

<mx:Text id="desc_txt" text="{data.descr}"
height="60" width="100%"
color="#777777" fontSize="10" />

However, if I try something like this, I get the error 'Error #1009:
Cannot access a property or method of a null object reference.'

<mx:Script>
<![CDATA[
private function text_init():void {
//title_txt.htmlText ="<b>"+data.name+"</b><br>"+data.descr;
var txt: String;
var title:String = data.name;
var desc:String = data.descr;
title_txt.htmlText ="<b>"+title+"</b><br>"+ desc;
}
]]>
</mx:Script>

<mx:Text id="title_txt"
fontSize="10" paddingBottom="0"
initialize="text_init()" />

I have tried many different approaches and it seems Flex keeps heading
me off at the pass.

Any suggestions would be appreciated.

Thanks,

Jeff

Reply via email to