Friday, December 14, 2012

Multi-dimensional arrays

Multi-dimensional arrays contain other arrays as elements. For example, consider a list of tasks that is stored as an indexed array of strings:
var tasks:Array = ["wash dishes", "take out trash"];
If you want to store a separate list of tasks for each day of the week, you can create a multidimensional array with one element for each day of the week. Each element contains an indexed array, similar to the tasks array, that stores the list of tasks. You can use any combination of indexed or associative arrays in multi-dimensional arrays. The following examples use either two indexed arrays or an associative array of indexed arrays. The two other combinations are left as exercises for the reader.
Programming Actionscript 3. Powered by Blogger.