Collection.getIterator()

Availability

Flash Player 7.

Edition

Flash MX Professional 2004.

Usage

collection.getIterator()

Returns

An Iterator object that you can use to step through the collection.

Description

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).

Example

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);
    }    
}