mike chambers | about

Central API Viewer

Friday, October 24, 2003

I was playing around with Flash MX Pro 2004 last night, and created this simple Central API viewer.

How much code did this take?

var myTreeDP = new XML();
myTreeDP.ignoreWhite = true;
myTreeDP.load("central.xml");

pBar.indeterminate = true;

myTreeDP.onLoad = function()
{ 
  myTree.dataProvider = myTreeDP;
 	pBar.indeterminate = false;
	pBar._visible = false;
}

handleTreeEvent = function(evt)
{
	var node = myTree.selectedNode;

	XML.prototype.ignoreWhite = true;
	var x = new XML("<xml>"+node.toString()+"</xml>");
	var n = x.firstChild.firstChild.attributes;
	
	var des;
	var fSig;
	
	if(n.isBranch == "true")
	{
		des = "";
		fSig = "";		
	}
	else
	{
		des = n.tiptext;
		fSig = n.object + n.text;
	}
	
	description.text = n.tiptext;
	sig.text = n.object + n.text;
	
}
myTree.addEventListener("change", handleTreeEvent);

Pretty simple stuff.

twitter github flickr behance