Another easy one about movie clips

Ok, I have it to where when you click on a button, a movie clip gets loaded into a certain position. I have another button that does the same thing. But for some reason, both movie clips won’t stay open at the same time. It’s like I can have one or the other. What’s wrong? Thanks!

nevermind, i figured that one out, but i do have another question. how do i get it so that the button they clicked on to load the movie clip, if they click it again, it unloads the movie clip?

set up a variable in the timeline:
clickN=0;

for the button AS:
on(release){
if(clickN==0){
container.loadMovie(“movie.swf”);
clickN+=1;}

else if(clickN!=0){
container.unloadMovie(“movie.swf”);
clickN-=1;
}
}

how would the code be different if i’m not using an external swf file, but a movie clip within the library and i’m using attachmovie?

hmm. i’ve never used attachMovie, but i’m thinking removeMovieClip will work…
http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary631.html

awesome, it works :slight_smile: thanks! I have another question though. When you push a button, a movie clip plays that displays a window (it’ll have some text in it probably). Now, there are probably going to be at least three of these windows. What I want is when you click a button, the corresponding window goes to the next available spot. If no window is open yet, the first button (could be any of the three) they push will open the window in the first spot, etc. I hope that kinda makes sense.

so are you saying you would have 3 empty containers to start and then each button would load a windowMC? but you want the windowMC to load into the next available empty container?

i don’t have containers, i just want them to load into the next available spot (leftmost position)

i’m thinking you’re going to have to use container MC’s to load them into. that way you can call it by it’s instance name and use the _x property. then you could use if statements to set up conditions in which you would attach an MC into a certain x location.

i have no idea how to do that. what are containers? just blank movie clips to load things into? how do i do that?

yeah, that’s what containers are. just goto Insert>new symbol>mc. then don’t put anything in it. go to the main timeline and put the movieclip in there. give it the instance name container.

ok, but i have no idea what to do once i get that done :frowning: i’m kinda confused

[font=Comic Sans MS]i’m confused on how i load them once i have the containers[/font]

i’m making a fla, i’ll attach it in a short bit.

ok, made a zip file. took a little longer than i thought it would, but such is life. it was an interesting challenge. i think this is what you were describing…

http://www.haveri-media.com/loadingMC.zip

your example is exactly what i’m looking for. i don’t have time at the moment to try and implement it but i will shortly. Thanks so much! I’ll get back to you and let you know how it turns out. Thanks again!

no problem. good luck w/that.