ActionScript 2.0 Components Language Reference |
|
|
|
| Collection interface > Collection.getIterator() | |||
Flash Player 7.
Flash MX Professional 2004.
collection.getIterator()
An Iterator object that you can use to step through the collection.
Method; returns an iterator over the elements in the collection. There are no guarantees concerning the order in which the elements are returned (unless this collection is an instance of a class that provides a guarantee).
The following example calls getIterator():
on (click) {
var myColl:mx.utils.Collection;
myColl = _parent.thisShelf.MyCompactDiscs;
var itr:mx.utils.Iterator = myColl.getIterator();
while (itr.hasNext()) {
var cd:CompactDisk = CompactDisc(itr.next());
var title:String = cd.Title;
var artist:String = cd.Artist;
trace("Title: " + title + " - Artist: " + artist);
}
}
|
|
|
|