MACROMEDIA FLASH MX 2004-USING COMPONENTS Use Manual page 175

Using components
Hide thumbs Also See for FLASH MX 2004-USING COMPONENTS:
Table of Contents

Advertisement

Description
Method; removes the specified item from the collection. Because
dynamically reduces the size of the collection, do not call this method while looping through an
iterator.
Example
The following example calls
var myColl:mx.utils.Collection;
myColl = _parent.thisShelf.MyCompactDiscs;
// get this from a text input box
var removeArtist:String = _parent.tArtistToRemove.text;
var removeSize:Number = 0;
if (myColl.isEmpty()) {
trace("No CDs in the collection");
}
else {
var toRemove:Array = new Array();
var itr:mx.utils.Iterator = myColl.getIterator();
var cd:CompactDisc = new CompactDisc();
var title:String = "";
var artist:String = "";
while (itr.hasNext()) {
cd = CompactDisc(itr.next());
title = cd.Title;
artist = cd.Artist;
if(artist == removeArtist) {
// mark this artist for deletion
removeSize = toRemove.push(cd);
trace("*** Marked for deletion: " + artist + "|" + title);
}
}
// after while loop, remove the bad ones
var removeCD:CompactDisc = new CompactDisc();
for(i = 0; i < removeSize; i++) {
removeCD = toRemove[i];
trace("Removing: " + removeCD.Artist + "|" + removeCD.Title);
myColl.removeItem(removeCD);
}
}
:
removeItem()
Collection interface (Flash Professional only)
Collection.removeItem()
175

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-USING COMPONENTS and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash mx

Table of Contents