Tag Archives: ActionScript 2

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

Useful code for debugging MovieClip.localToGlobal() headaches

I hate localToGlobal. There I’ve said it. It seems that there are some things in Actionscript that always seem to throw me off – this is my main one.
Today I had another issue while adding a generic tooltip to buttons that in an assortment of sub clips and components – the tooltip needs to know [...]

Posted in flash | Also tagged 1 Comment