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