FORUMS: list search recent posts

How to clear MC content (all ldepths)

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Infected Cell
How to clear MC content (all ldepths)
on Jul 31, 2006 at 6:53:18 am

Hi,
Just one more problem.

I attached a few MC`s in one Main MovieClip by using function "for"

Here is the example:

var num:Number=0;
var butX:Number=0;
for (i=0;i if (num num++;
}
var button = mainMC.attachMovie("smallBut","smallBut"+num,num)
button._x=0;
button._y=butX
but._x=but._x+30;
}
* - name.length - is a unique number (depends on quantity of information in XML file)

So, if I`ll hit a button on main Stage I want to clear ALL!!! depths in "mainMC" and load new others
(name.length - number is a different each time.... may be more or less than previous time)

I have tried:

1. mainMC.unloadMovie();
or
2. for (d=0;d<200;d++){
mainMC.unloadMovieNum(d);
}

but I did not solve this problem.

HOW TO CLEAR THE CONTENT (IN ALL DEPTHS) OF MOVIECLIP mainMC????



Thanks

Best regards,
Alexey Kharitonov.
http://www.infectedcell.com
mailto:contact@infectedcell.com


Return to posts index

lajoiet
Re: How to clear MC content (all ldepths)
on Jul 31, 2006 at 1:33:38 pm

an easy way to do this is to register all of your objects in an array, so define an array in your main code:

var clipContents:Array = new Array;

then after you create an object, push it into the array, so in the loop that makes the buttons, put:

clipContents.push(button);

which will add each item's reference into the array, then when you want to get rid of them, loop through the array and use removeMovieClip to remove all of the objects registered in the array (I didn't test this, so I'm not sure if it's 100% accurate, but it's close and should get you on the right track):

for (i=clipContents.length;i<=0;i--) {
removeMovieClip(clipContents[i]);
clipContents.splice(-1);
}


Return to posts index

Matt Klundt
Re: How to clear MC content (all ldepths)
on Jul 31, 2006 at 7:27:13 pm

How about two lines:

removeMovieClip(mainMC);
createEmptyMovieClip("mainMC", 0);

Matt
--------------------
http://www.mcquillendesign.com
http://www.mattfoxgames.com


Return to posts index


Infected Cell
Re: How to clear MC content (all ldepths)
on Aug 2, 2006 at 12:39:35 pm

Hi,

Great idea....
I did not think about it....

The first line will delete my MC with all content and the second line will create new one MC with the same name...

I think it should work.

Thanx for help.

Best regards,
Alexey Kharitonov.
http://www.infectedcell.com
mailto:contact@infectedcell.com


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]