Skip to main content
Participating Frequently
December 18, 2008
Question

Calling a MC from the library with a button

  • December 18, 2008
  • 2 replies
  • 544 views
Hi,

I have created a movie clip in the library and a button on my stage that I want to play the Movie Clip.
I need a simple code that will call the movie clip when the button is pressed and then when the user wants to close the movie clip I want them to be able to do that via a button inside the movie clip.

I know this is a very simple question and any help would be much much appreciated.

Thanks

Jacq =)
This topic has been closed for replies.

2 replies

kglad
Community Expert
Community Expert
December 19, 2008
that's not correct syntax for attachMovie(). at least 3 parameters are required:

parentMC.attachMovie(linkageID,mcName,depth);
kglad
Community Expert
Community Expert
December 18, 2008
you need to assign a linkage id to your movieclip and use the movieclip method attachMovie() to instantiate your library movieclip.

in the help files under the movieclip class, check attachMovie().
nogreydesAuthor
Participating Frequently
December 19, 2008
ok kglad I have looked that up.

I have now attached this code to my button

on(press){
attachMovie("life_mcMc");
}
on(release){
play._life_mcMc

}

I know it is wrong!
I now understand how to attach the movie clip now how do i get it to show up and play on screen/stage?

I then want to be able to close/unload movie clip via a button within the movie which I assume i would then code to be something like
on (release) {
_root.gotoAndPlay("brochures");
}

but will that then unload/remove the movie clip from the screen/stage?
(the movie clip I am playing is basically a simulation of a pop up screen transparent over the rest of my site)

thanks for your help