views:

72

answers:

2

when i selected a XML node to tree by doing... i am using flex SDK 3.5 it was working fine in SDK 3.


tree.selectedItem=XML(node);

and then get..
trace(tree.selectedItem.toString());

i get error that object is null...

+1  A: 

It looks like your cast to XML is yielding a null.

Try this...

var x = node as XML;
trace(x.toString());

If you halt the debugger at the line before and inspect node, what type is it? My bet is that node and XML are not compatible types and the above will throw the same error.

Simon
that is not the issue the thing was working perfectly in sdk 3, i have even tried to assign the item of which tree is made. but of no use.'tree.selectedItem=XML(node);'no item is selected...
Muhammad Husnain Ashfaq
A: 

actually its bug in Flex SDK 4.0 ,,, you can assign using callLaterFunction().

Muhammad Husnain Ashfaq