Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remove all clips from a parent clip?

Status
Not open for further replies.

Leozack

MIS
Oct 25, 2002
867
0
0
GB
I've been workin away through problems today but I hadda take a break when I got stuck on this one. I have movieclips that contain other movieclips, created dynamically in script. 1 such clip is imgItemsMC which is a container for item clips. I'm parsing a list of items each with a numerical ID, and adding them to ItemMC like this

var thisItem_mc = imgItemsMC.attachMovie("circle", "Item_mc"+itemNum,itemNum);

It may not be the best method but it's the one I had been using previously to just get them in and working. "circle" is a library item with export for actionscript set, and itemNum is the ID of the item I'm inserting a symbol for.

The problem is - when loading a new list of items I need to clear everything off first. I tried imgItemsMC.unloadMovie() but then when I tried to add new items to imgItemsMC they didn't appear, so that can't be right. Is there an easy way to remove all contents of a clip? I suppose if it was necessary I could remove the actual clip and remake it again but there must be an easy way I've missed! this is Flash MX 6 / AS2

_________________________________
Leozack
Code:
MakeUniverse($infinity,1,42);
 
Having looked into the plan B (remaking the clip) it seems the desired result is acheived just by repeating the clip creation command

imgItemsMC = imgMC.createEmptyMovieClip("imageitems_mc", 3);

I guess this remakes the dynamic clip in the same layer it was in on the parent clip, thus creating a blank canvas and all previously added items are gone. This is what I want for adding new items to it so I think this will do and has no side effects :)

_________________________________
Leozack
Code:
MakeUniverse($infinity,1,42);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top