Tag Archives: as3

Finding a specific node in an AS3 XML object

Continuing with my updating an Actionscript 2 project to Actionscript 3 I’m really enjoying the optimisation possibilities.
For example, In my as2 code I had a recursive method for finding a node.

// recursive node search
private function findNode(n:XMLNode,name:String,attname:String,attdata:String):XMLNode{
var xNode:XMLNode;
if(n.hasChildNodes()){
for(var i = 0; i < n.childNodes.length; i++){
if(n.childNodes[i].nodeName == name){
if(n.childNodes[i].attributes[attname] == attdata){
xNode = n.childNodes[i];
}
}
if(xNode != undefined){
break;
}else if(n.childNodes[i].hasChildNodes()){
xNode = [...]

Posted in Code, flash | Also tagged , , 1 Comment

Actionscript 3: Inheritance Subclass and private vars

I’m currently updating some as2 projects to as3 and I had a series of 1120 compiler errors this afternoon. I’m a fan of using the ‘extends’ keyword to create customised versions of base classes.
In Actionscript 2 the subclass can access all the variables and methods of the original class. It appears that in ActionScript [...]

Posted in Code, flash | Also tagged , , , , , 3 Comments