ActionScript 2.0 Components Language Reference |
|
|
|
| Iterator interface > Iterator.next() | |||
Flash Player 7.
Flash MX Professional 2004.
iterator.next()
An object that is the next item in the iterator.
Method; returns an instance of the next item in the iterator. You must cast this instance to the correct type.
The following example uses the next() method to access the next item in a collection:
on (click) {
var myColl:mx.utils.Collection;
myColl = _parent.thisShelf.MyCompactDisks;
var itr:mx.utils.Iterator = myColl.getIterator();
while (itr.hasNext()) {
var cd:CompactDisk = CompactDisk(itr.next());
var title:String = cd.Title;
var artist:String = cd.Artist;
trace("Title: "+title+" Artist: "+artist);
}
}
|
|
|
|