Flex Tree Properties, Null Reference?

Posted by mvrak on Stack Overflow See other posts from Stack Overflow or by mvrak
Published on 2009-02-02T13:42:31Z Indexed on 2010/04/05 22:03 UTC
Read the original article Hit count: 204

Filed under:
|
|

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?

© Stack Overflow or respective owner

Related posts about flex

Related posts about tree