Extending AS2 Array
October 23rd, 2003
According to gSkinner’s post, when you extend an array you must call the superClass constructor in a particular way so that the indefinite amount of arguments get passed along correctly to the parent class:
class ArrayExtended extends Array
{
function ArrayExtended(){
super.constructor.apply(this, arguments);
}
public function someFunc(){
return length;
}
}
Well, that never worked for me… actually that’s very strange because it appears as if it works for some but not for others..
today i came across a post a Tween Pix and the solution that i saw there is working:
class ArrayExtended extends Array
{
function ArrayExtended(){
splice.apply(this, [0, 0].concat(arguments));
}
public function someFunc(){
return length;
}
}
but im still wondering WHY the gskinner’s variant doesn’t work for me??!
UPDATE:
The solution above (the one that works for me) was actually first posted at flashcoders mailing list

November 4th, 2003 at 7:58 pm
Yes, and here’s the explanation :
http://chattyfig.figleaf.com/ezmlm/ezmlm-cgi?1:mss:90589:200310:gfdhpdjdimjpaiklabja
November 4th, 2003 at 8:26 pm
thanx Francis. now i get it.