PDA

View Full Version : closing one MC & prompting another MC to open



pixiesparkles13
September 25th, 2003, 04:59 PM
Hello

I am trying to close one movie clip and then with the same button, prompt another to open.

this code opens and closes it...

this.attachMovie("popup1", "popup1",1);
this.popup1.close.onpress = function () {
removeMovieClip(popup1);
{

But how do I get popup2 to open when popup1 closes?

Any help will be greatly appreciated!
:sigh:

kode
September 25th, 2003, 05:57 PM
Hey pixies,

If you attach popup2 at the same depth than popup1, it will replace popup1. ;)

this.attachMovie("popup1", "popup1", 1);
this.popup1.close.onPress = function() {
this._parent._parent.attachMovie("popup2", "popup2", 1);
};
And welcome to kirupa forum!! :P

pixiesparkles13
September 25th, 2003, 06:02 PM
Hi Kode,

Thanks much for the welcome:beam:

And thanks so much for the solution

I need to open 4 more mc's the same way...

popup2 closes popup3 opens ect...

any ideas

I have been confusing myself for hours now
I really appreciate it!

kode
September 25th, 2003, 07:11 PM
In that case, I'd set up a function to automatize the proccess a bit. :P

Here's a quick and untested example:

function attachPopup() {
if (index<linkages.length) {
var linkage = linkages[index++];
popup = attachMovie(linkage, linkage, 1);
popup.close.onPress = attachPopup;
} else {
popup.removeMovieClip();
}
}
var linkages = ["popup1", "popup2", "popup3", "popup4"];
var index = 0;
var popup = undefined;
attachPopup();
I think it should work... ;)