Tutorials, extensions, and source files for ActionScript, Flash, and other Adobe products.

 

senocular.com ActionScript Library

firstNodes.as

1
2
3
4
5
6
7
8
9
10
11
// adds a firstNodes property (read-only) which returns
// an array of all the nested first child elements within an
// xml node. ex: firstChild.firstChild.firstChild == firstNodes[2]
XMLNode.prototype.addProperty("firstNodes",
	function(){
		var c = [];
		var n = this;
		while(n = n.firstChild) c.push(n);
		return c;
	},null
);