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:
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:
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:
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