# \[AS 2.0 Help\] arrays with two rows

**URL:** <https://forum.kirupa.com/t/as-2-0-help-arrays-with-two-rows/260373>\
**Category:** flash\
**Created:** [May 14, 2008, 9:57pm UTC](https://forum.kirupa.com/t/as-2-0-help-arrays-with-two-rows/260373 "2008-05-14T21:57:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![shaunak84](https://avatars.discourse-cdn.com/v4/letter/s/9fc348/32.png) [@shaunak84](https://forum.kirupa.com/u/shaunak84)\
**Post date:** [May 14, 2008, 9:57pm UTC](https://forum.kirupa.com/t/as-2-0-help-arrays-with-two-rows/260373/1 "2008-05-14T21:57:22Z")

</div>

I’m using AS 2.0 - Can anyone point me to some info on using matrices?

I want to store sets of points in an array like so:

arrP = [[0,0],[50,0],[50,50],[0,50]];

How would I declare an array like that? And do I access it the same way as any other programming language? Ex: if(arrP[0][0] == 0)

The way I’m using it now I just declare var arrP = new Array(); Not sure if that works for a two dimensional array as well.

And for accessing/altering I’m using arrP\*[0] or arrP\*[1].

I’m pretty sure my problem is with the declaration.

---

<div class="post-metadata">

**Author:** ![Michael\_Chen](https://avatars.discourse-cdn.com/v4/letter/m/b5ac83/32.png) [@Michael\_Chen](https://forum.kirupa.com/u/Michael_Chen)\
**Post date:** [May 15, 2008, 1:28am UTC](https://forum.kirupa.com/t/as-2-0-help-arrays-with-two-rows/260373/2 "2008-05-15T01:28:19Z")

</div>

In AS2 you can use arrays to store matrices.

For example…

```auto

var arrP:Array = new Array();
arrP = [[0,0],[50,0],[50,50],[0,50]];

arrP[0][0] = -1;
arrP[3][1] = 1000;

for(var a:Number = 0; a < arrP.length; a++) {
	for(var b:Number = 0; b < arrP[a].length; b++) {
		trace(arrP[a]**);
	}
}

```
