Flex Tree Properties, Null Reference?
- by mvrak
I am pulling down a large XML file and I have no control over it's structure.
I used a custom function to use the tag name to view the tree structure as a flex tree, but then it breaks. I am guessing it has something to do with my other function, one that calls attribute values from the selected node.
See code.
<mx:Tree x="254" y="21" width="498" height="579" id="xmllisttree" labelFunction="namer" dataProvider="{treeData}" showRoot="false" change="treeChanged(event)" />
//and the Cdata
import mx.rpc.events.ResultEvent;
[Bindable] private var fullXML:XMLList;
private function contentHandler(evt:ResultEvent):void{
fullXML = evt.result.page;
}
[Bindable]
public var selectedNode:Object;
public function treeChanged(event:Event):void {
selectedNode=Tree(event.target).selectedItem;
}
public function namer(item:Object):String {
var node:XML = XML(item);
var nodeName:QName = node.name();
var stringtest:String ="bunny";
return nodeName.localName;
}
The error is TypeError: Error #1009: Cannot access a property or method of a null object reference.
Where is the null reference?