1 Reply Latest reply on Jul 9, 2009 6:54 AM by Gregory Lafrance

    i want to create a 3*3 multidimensional array of label objects

    selvakumar p

      i want to initialize the array with label objects help me

        • 1. Re: i want to create a 3*3 multidimensional array of label objects
          Gregory Lafrance Level 6

          If this post answers your question or helps, please mark it as such.

           

          <?xml version="1.0"?>
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
            creationComplete="init();">
            <mx:Script>
              <![CDATA[
                import mx.controls.Label;
                private var arr:Array = new Array();
                private function init():void{
                  for(var a:uint=0;a<10;a++){
                    var inArr1:Array = new Array();
                    for(var b:uint=0;b<10;b++){
                        var inArr2:Array = new Array();
                      for(var c:uint=0;c<10;c++){
                        var lbl:Label = new Label();
                        lbl.text = "Label" + a + b + c;
                        inArr2.push(lbl);
                      }
                      inArr1.push(inArr2);
                    }
                    arr.push(inArr1);
                  }
                
                  for each(var xArr:Array in arr){
                    for each(var yArr:Array in xArr){
                      for each(var lbl2:Label in yArr){
                        txt.text += lbl2.text + " ";
                      }
                    }
                  }
                }
              ]]>
            </mx:Script>
            <mx:TextArea width="100%" height="100%" id="txt"/>
          </mx:Application>
          
          
          1 person found this helpful