rysolag  
                
                  
                    September 4, 2003, 10:32pm
                   
                  1 
               
             
            
              I want to create a 2 dimensional array that is 55x40 and holds integers(initialized to zero); what is the code?
I tried using
for(i = 0; i < 55; i++)
but when I trace the values out it says undefined…
thanks
             
            
              
            
           
          
            
              
                system  
              
                  
                    September 4, 2003, 10:41pm
                   
                  2 
               
             
            
              arrays are 1 dimensional as far as I know. You would have to store arrays inside arrays to get a 2d type I think. There might be a 2d way, I just dont know it.
             
            
              
            
           
          
            
              
                system  
              
                  
                    September 4, 2003, 10:41pm
                   
                  3 
               
             
            
              myarray = new Array(55)
for( i=0; i<55; i++ ) {
myarray* = new Array(40)
for( j=0; j<40; j++ ) {
myarray*[j] = 0
trace ( myarray*[j] )
}
}
 
            
              
            
           
          
            
              
                system  
              
                  
                    September 4, 2003, 10:42pm
                   
                  4 
               
             
            
              Hi,
try this instead
myArray = new Array();
Liz
             
            
              
            
           
          
            
              
                system  
              
                  
                    September 4, 2003, 10:49pm
                   
                  5 
               
             
            
              Thanks ahmed…that works.
I thought you did’nt need to allocate vars in Flash.
             
            
              
            
           
          
            
              
                system  
              
                  
                    September 4, 2003, 10:52pm
                   
                  6 
               
             
            
              its not the allocating, he put arrays inside arrays. he has one array filled with 55 more arrays each 40 in length. This basically creates a 2d array.