# Creating multidimensional array from grid

**URL:** <https://forum.kirupa.com/t/creating-multidimensional-array-from-grid/199204>\
**Category:** flash\
**Created:** [August 31, 2006, 6:12pm UTC](https://forum.kirupa.com/t/creating-multidimensional-array-from-grid/199204 "2006-08-31T18:12:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tsukiyomi](https://avatars.discourse-cdn.com/v4/letter/t/e5b9ba/32.png) [@Tsukiyomi](https://forum.kirupa.com/u/Tsukiyomi)\
**Post date:** [August 31, 2006, 6:12pm UTC](https://forum.kirupa.com/t/creating-multidimensional-array-from-grid/199204/1 "2006-08-31T18:12:46Z")

</div>

I have a program where there are 63 squares set up in 9 rows and 7 columns like so:

* * *

## | 1 | 2 | 3 | 4 | 5 | 6 | 7 | | 8 | 9 | 10 | 11 | 12 | 13 | 14 | | 15 | 16 | 17 | 18 | 19 | 20 | 21 | | 22 | 23 | 24 | 25 | 26 | 27 | 28 | | 29 | 30 | 31 | 32 | 33 | 34 | 35 | | 36 | 37 | 38 | 39 | 40 | 41 | 42 | | 43 | 44 | 45 | 46 | 47 | 48 | 49 | | 50 | 51 | 52 | 53 | 54 | 55 | 56 | | 57 | 58 | 59 | 60 | 61 | 62 | 63 |

Each of these squares is set up as a movie clip in a mask, the goal of which is to get them to transition in diagonally to reveal the image.

As it stands right now I have a multidimensional array holding the order in which the squares are supposed to play. These are the orders in which I want them to play (so it looks like diagonal rows coming in):

**From top right:**

1 - #7 alone  
2 - 6, 14 together  
3 - 5, 13, 21  
4 - 4, 12, 20, 28  
5 - 3, 11, 19, 27, 35  
6 - 2, 10, 18, 26, 34, 42  
7 - 1, 9, 17, 25, 33, 41, 49  
8 - 8, 16, 24, 32, 40, 48, 56  
9 - 15, 23, 31, 39, 47, 55, 63  
10 - 22, 30, 38, 46, 54, 62  
11 - 29, 37, 45, 53, 61  
12 - 36, 44, 52, 60  
13 - 43, 51, 59  
14 - 50, 58  
15 - 57

This works to get the effect I want, but the main problem is I would prefer it to be dynamic in case I ever add more rows of columns, so I was wondering if anyone could figure out a way for me to dynamically generate this depending on how many rows and columns exist in the movie.
