3 Replies Latest reply on Dec 18, 2008 9:59 PM by kglad

    Calling a MC from the library with a button

    nogreydes
      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 =)
        • 1. Re: Calling a MC from the library with a button
          kglad Adobe Community Professional & MVP
          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().
          • 2. Re: Calling a MC from the library with a button
            nogreydes Level 1
            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
            • 3. Re: Calling a MC from the library with a button
              kglad Adobe Community Professional & MVP
              that's not correct syntax for attachMovie(). at least 3 parameters are required:

              parentMC.attachMovie(linkageID,mcName,depth);