Re: [Flashcoders] Array like access to custom class?

2005-12-20 Thread Morten Barklund Shockwaved
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

RE: [Flashcoders] Array like access to custom class?

2005-12-20 Thread Dan Thomas
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

Re: [Flashcoders] Array like access to custom class?

2005-12-20 Thread Morten Barklund Shockwaved
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:

Re: [Flashcoders] Array like access to custom class?

2005-12-20 Thread ryanm
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