3 Replies Latest reply on May 4, 2010 12:12 AM by Vikash.kumar29

    i need array within array?

    welcomecan

      hai friends,

          i need array within array?  if u know let me know.

       

      regards,

      welcome can

        • 1. Re: i need array within array?
          Vikash.kumar29 Level 3

          You can always add array as child within array like:

           

          var array:Array = new Array();

          var childArray:Array = ["Data 1","Data 2"];

          array.push(childArray);

           

          and you can check the elements like

           

          trace(array[0][0]); //outputs Data 1

           

          trace(array[0][1]);//outputs Data 2

           

          Hope this helps you

          Cheers

          -Vikash

          • 2. Re: i need array within array?
            welcomecan Level 1

            how to use in menu bar.

             

            give example

             

            regards,

            welcomecan

            • 3. Re: i need array within array?
              Vikash.kumar29 Level 3

              Hi You can use the following code for menu bar :

               

               

              <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="onCC()">
                    <mx:Script>
                         <![CDATA[
                              import mx.controls.Alert;
                              
                              [Bindable]public var menuCollection:Array;
                              private function onCC():void
                              {
                                   menuCollection = [{label:"Menu 1",children:[{label:"Item 1"},{label:"Item 2",children:["Sub Menu 1","Sub Menu 2"]}]}
                                                         ,{label:"Menu 2",children:["Item 3","Item 4"]}];
                              }
                               
                         ]]>
                    </mx:Script>
                    <mx:ApplicationControlBar>
                         <mx:MenuBar id="menu" dataProvider="{menuCollection}"/>
                    </mx:ApplicationControlBar>
              </mx:Application>
              

               

              Cheers

              -Vikash