I’m trying to create a Red-Black Tree algorithm.
I wanted to detect if there is a second layers, and if it does, how many and what is it.
I’m kinda stuck now, any guide would be appreciated. thanx!
private function dataLevel():void {
//Level 2
a1=new Array("a1a","a1b");
a2=new Array("a2a","a2b");
//Level 1
allA=new Array(a1,a2);
//------------------------------------------------------------------------------------------------------------
//trace if the following level exist
//if the following level exist, create the Branch
if (allA is Array==true) {
createBranch(allA);
}
if (allA is Array==true) {
createBranch(allA);
}
}
private function createBranch(event:Object):void {
for (var i:Number=0; i<a1.length; i++) {
branchNcircles = new MovieClip();
if (parent is Array==false) {
branchNcircles.x=trunks.x;
branchNcircles.y=trunks.y;
}
branchNcircles.rotation=Math.floor(Math.random()*160)-90;
addChild(branchNcircles);
}