# Red-Black Tree Implementation

**URL:** <https://forum.kirupa.com/t/red-black-tree-implementation/297806>\
**Category:** flash\
**Created:** [October 8, 2009, 3:32pm UTC](https://forum.kirupa.com/t/red-black-tree-implementation/297806 "2009-10-08T15:32:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![youwh](https://avatars.discourse-cdn.com/v4/letter/y/82dd89/32.png) [@youwh](https://forum.kirupa.com/u/youwh)\
**Post date:** [October 8, 2009, 3:32pm UTC](https://forum.kirupa.com/t/red-black-tree-implementation/297806/1 "2009-10-08T15:32:27Z")

</div>

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!

```auto
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);
}

```
