# Extending Array in AS3.0

**URL:** https://forum.kirupa.com/t/extending-array-in-as3-0/196471
**Category:** Uncategorized
**Created:** [August 8, 2006, 6:03pm UTC](https://forum.kirupa.com/t/extending-array-in-as3-0/196471 "2006-08-08T18:03:40Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![jwopitz](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/jwopitz/32/1556_2.png) [@jwopitz](https://forum.kirupa.com/u/jwopitz)
#### Post date: [August 8, 2006, 6:03pm UTC](https://forum.kirupa.com/t/extending-array-in-as3-0/196471/1 "2006-08-08T18:03:40Z")

</div>

I have a class that I am converting from AS2.0 to AS3.0. In AS2 it works perfectly. But in AS3 I am getting a weird error. Here is what I have in the .fla:

```auto
var pts:PtManager = new PtManager ();
pts[0] = "point";
trace (pts[0]);

```

and it gives me this error:

_ReferenceError: Error #1056: Cannot create property 0 on com.jwopitz.geom.PtManager.  
at Timeline0\_74cb4621d598448a6e3c45cb373913/::frame1()_

So now look at this. I have a command in the class file that creates and registers a new pt:

```auto
public function registerPt (pt:Pt):void {
            this.push (pt);
            return void;
        }

```

Now if I do this in the .fla it will return length but still no access to the item in the array:

```auto
var p:Pt = new Pt (0, 0, 0);//my own pt class ;)
var pts:PtManager = new PtManager ();
pts.registerPt (p);
trace (pts.length) //outputs 1;
trace (pts[0]); //outputs the error

```
