Showing posts with label action script. Show all posts
Showing posts with label action script. Show all posts

Thursday, 17 May 2012

Checking for empty xml nodes in as3

Something thats puzzled me for a bit is how to check for empty xml nodes.

so something like....

<aidanmack></aidanmack>


ok so this script isn't all there but I reckon you should get the idea.
 I would of thought doing something like this....

if(aidanmack == null){
trace("its empty")
}


or

if(aidanmack == undefined){
trace("its empty")
}

or

if(aidanmack ==""){
trace("its empty")
}

... WOULD have worked but noooo. doesn't bite at all!

Instead I've found you have to check the length!

so..

if(aidanmack.length > 0){
trace("has something in it");
}else{
trace("its empty");
}



Wednesday, 14 December 2011

Corona Modules... the little buggers.

So Modules in Corona are easy to use but dont work so well...
Ansca may brag that coding with lua is "simpler" and less code than action script. But they should really look at why action script has matured over the years specifically to deal with issues like the one I am having with modules.

If your having trouble with global variables and modules that you thought you had cleared out but dont... then this might be the way forward. I think i will be trying this over the weekend...
A Better Approach to External Modules

I will right my own example when I understand this method better.