Dan Thomas wrote:
Can I provide array like access to a custom collection object?
E.g.
Class MyClass
{
private var myArray:Array;
public function getArray():Array
{
return this.myArray;
}
}
[snip]
How can I change it so I can achieve
Thanks very much Morten
DannyT
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Morten
Barklund Shockwaved
Sent: 20 December 2005 13:15
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Array like access to custom class?
Dan Thomas wrote:
Can I
someClass.elem(0) = myObj;
Nope - of course not. elem is a function - you can't use it that way.
You can do anything you like, though. Create your own function for instance:
someClass.setElem(0, myObj);
Or a general addElem, that doesn't take a position argument but just
pushes to the end:
Can I provide array like access to a custom collection object?
The easiest way would be to extend Array. Then you start with all the
functionality of the Array object, and you can add or remove functionality
as needed.
ryanm
___
Flashcoders
4 matches
Mail list logo