Depends on the internal structure of your collection. If your collection is stored as an Array then you can use properities to achieve a square bracket effect:
/*** MyCollection class ***/
private var elementHolder : Array;
public function get getElementAt() : Array{
return elementHolder;
}
/*** Some other class******/
public function main() : void{
trace("Element at 3: " + myCollection.getElementAt[3] );
}
If your collection is not stored in an array maybe you can convert it to an array (like the java Collection's toArray() method).
for example, if your collection is a linked list:
/*** MyCollection class ***/
public function get getElementAt() : Array{
var temp : Array = new Array();
while( node.next != null{
temp.push( node );
}
return temp;
}
/*** Some other class******/
public function main() : void{
trace("Element at 3: " + myCollection.getElementAt[3] );
}