I am going to use the removeMovieClip(“SomeMovie”); command. Is it possible to close multiple movie clips using only one of “removeMovieClip”? For example, i want to close movie1, movie2, and movie3.
try this:
for (i=1; i<4; i++) { clip = this["movie"+i]; removeMovieClip(clip); }
Well, actually, my movies are not named that simply (movie 1,2,3…). A better example is: service, profile, contact.
You can only use removeMovieClip if the mc was created using attachMovie or duplicateMovieClip. Just in case you dont know…
Then what do I use for regular ones?
unloadMovie or unloadMovieNum
how do I close multiple movie clips with just using one line of code so that I don’t waste time writing so much code?
You want to unload them on a button event?
Are the mcs loaded into level or target?
on release
Are the mcs loaded into level?
they are on the same level as the button that wants to close them
If so, try this:[AS]max = 2;//im assuming you want to unload mcs on levels 1 and 2
unload = function(){
for (i=1; i<=max; i++) {
unloadMovieNum(i);
};
}
button.onPress = unload;[/AS]
var movies = [service, profile, contact], index;
myButton.onRelease = function() {
for (index=0; index<movies.length; index++) {
movies[index].swapDepths(1000+index);
movies[index].removeMovieClip();
}
};
the removeMovieClip method only works if the MovieClip depth is equal or greater than 0.
where do you put this code?
you put the code on the Frame actions. where myButton is the instance name of the Button that should remove those MovieClips.
I didnt know you could swap depths to remove the mcs… :!:
thx again kax
This code broke the rollovers I had on my button. They don’t show anymore. And also, I didn’t want the movie clips to disapear forever. They should be able to come back when an action loads them again.
Why?
I am making a navigation system. Each section is a different movie clip symbol. When the user wants to go to another section, the current section must be removed. But, the removed section should only be temporary, as people might want to go back.
Use[AS]moviclip._visible = false;[/AS]
- claudio
no problem.
and actually, you shouldn’t thank me… i learned that from senocular.
- Supree
if you need to load them again, you should use the attachMovie method to load them from the Library whenever you need those MovieClips. =)
or you could listen to claudio.