var num:Number = 10;
var refs:Array = new Array();
function createClips() {
for(var i=0; i<num; i++) {
var mc:MovieClip = createEmptyMovieClip("dummy"+i, getNextHighestDepth());
refs.push(mc);
}
trace(refs.length);
}
function removeClips() {
for(var i=0; i<num; i++){
refs.pop().removeMovieClip();
}
trace(refs.length);
}
createClips();
removeClips();
----- Original Message -----
From: "Omar Fouad" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, September 10, 2007 1:00 AM
Subject: Re: [Flashcoders] How do you delete child movieclips?
> If i get your explanation you are going to index the instance name of each
> childMc inside an array, to later delete mcArray[0], mcArray[1],mcArray[2]
> and so on as in:
>
> mcArray[0] = mc1.mc2;
> and so on...
>
> in this case try:
>
> unloadMovie(mcArray[0]); // will delete the mc2 inside mc1
>
>
> Note that this will remove the movieclip visually only, so you'll have to
> add a delete statement after it as:
>
> //let's assume you have a button that does it
>
> mcArray = [];
> mcArray[0] = mc1.mc2;
>
> but.onRelease = function () {
> unloadMovie(mcArray[0]);
> trace(mcArray[0]); // traces _level0.mc1.mc2
> delete mcArray[0]; // deletes the movieClip referred to the array
> index 0, not the value of the array element itself!
> trace(mcArray[0]); // traces undefined.
> }
>
> hope this helps...
>
> cheers
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com