18 Replies Latest reply on Jun 1, 2007 1:01 PM by kglad

    Remove Movie Clip

    elearningdiva Level 1
      I would like to have the user click on a button or movie clip that takes them to a new scene with multiple questions on it, and depending on what answer they choose, come back to the main scene and the button be gone, and replaced with a graphic (that won't have any function). I thought I could change the alpha of the graphic (sallylock_mc) from 0 to 100, but its only staying on 0. And, I can't figure out how to make sally_mc disappear. So far, here's what I have:

      Main scene:

      stop();

      sallylock_mc._alpha=0

      sally_mc.onRelease=function(){
      _root.gotoAndPlay("sally");
      }


      "sally" scene:

      stop();

      sallyright_btn.onRelease=function(){
      _root.gotoAndPlay("main");
      sallylock_mc._alpha=100
      }

        • 1. Re: Remove Movie Clip
          kglad Adobe Community Professional & MVP
          convert your graphic to a movieclip and give it a linkage id, say sallyID. you can then use:

          • 2. Remove Movie Clip
            elearningdiva Level 1
            Hmm, that's not totally working for me :( The graphic is already a movie clip, its called sallylock_mc. And, from your code, I was able to figure out how to mack that show up where I want it and when. However, how do I make sally_mc go away after the user comes back to the main scene (from the sally scene) after hitting the button called sallyright_btn?

            TIA!
            • 3. Re: Remove Movie Clip
              kglad Adobe Community Professional & MVP
              if sallyright_btn is a movieclip, change sally_mc to sallyright_btn in the code i gave above. if it's a button use the _visible property.
              • 4. Re: Remove Movie Clip
                elearningdiva Level 1
                sorry, I edited while you were replying.
                • 5. Remove Movie Clip
                  elearningdiva Level 1
                  ok, sorry for the confusion.

                  sallyright_btn is a button. I can't figure out how to make sally_mc (which is a movie clip in a different scene) disappear when I click sallyright_btn.

                  I can change sally_mc to a button if I need to, it really doesn't need to be a movie clip as far as I'm concerned :)

                  AND, I only want sallylock_mc to exist on the "main" scene. :)
                  • 6. Re: Remove Movie Clip
                    kglad Adobe Community Professional & MVP
                    you can't control a movieclip before it exists. so, if sally_mc doesn't exist in the frame when you're clicking sallyright_btn there's no code in THAT frame that will affect sally_mc.

                    so, you'll need to set a variable's value in sallyright_btn and you'll use that variable in an if-statement attached to the frame where sally_mc exists.

                    for example:

                    • 7. Re: Remove Movie Clip
                      elearningdiva Level 1
                      OK :)

                      sally_mc (I changed it to a button, so now it will be refrenced as sally_btn) exists in the very first frame of the first scene ("main")of the movie. You have to click it to go to the scene called "sally" Within the scene called "sally", there is a question and answers. When the user clicks the right answer, I want them to go back to the "main" scene, and I want sally_btn to be gone, and replaced with what looks like a padlock, which I have called sallylock_mc (it is a movie clip, don't know if it has to be or if it should be something else.) Also, I want the padlock to only exist/be visible on the "main" scene. I've found that when I go to the other scenes, the padlock is there, ontop of everything else.

                      I've attached the code in "main", and in "sally":

                      • 8. Remove Movie Clip
                        elearningdiva Level 1
                        Doh! I figured out this:

                        sallyright_btn.onRelease=function(){
                        this._parent.attachMovie("sallylock_ID","sallylock_mc",this._parent.getNextHighestDepth() , {_x: 197.3, _y: 62.4});
                        sally_btn._visible=0;
                        _root.gotoAndPlay("main");
                        }

                        needs to be this to make the sally_btn go away:

                        sallyright_btn.onRelease=function(){
                        this._parent.attachMovie("sallylock_ID","sallylock_mc",this._parent.getNextHighestDepth() , {_x: 197.3, _y: 62.4});
                        _root.gotoAndPlay("main");
                        sally_btn._visible=0;
                        }

                        But, still need to figure out how to keep the padlock ONLY on the "main" scene...
                        • 9. Re: Remove Movie Clip
                          kglad Adobe Community Professional & MVP
                          what's "...the padlock..."?
                          • 10. Re: Remove Movie Clip
                            elearningdiva Level 1
                            LOL, sorry. Its sallylock_mc. I'm experimenting with using the _visible property, but, its not working :(

                            main scene code:

                            stop();

                            sallylock_mc._visible=false;

                            sally_btn.onRelease=function(){
                            _root.gotoAndPlay("sally");
                            }

                            mary_btn.onRelease=function(){
                            _root.gotoAndPlay("mary");
                            }

                            sally scene code:

                            stop();

                            sallyright_btn.onRelease=function(){
                            _root.gotoAndPlay("main");
                            sally_btn._visible=false;
                            sallylock_mc._visible=true;
                            }
                            • 11. Re: Remove Movie Clip
                              kglad Adobe Community Professional & MVP
                              instead of using this._parent to attach sallylock_mc, use an empty movieclip that you place an stage where needed in a frame where it's needed and remove it at the end of "main" scene.
                              • 12. Re: Remove Movie Clip
                                elearningdiva Level 1
                                That sounds promising, but, I'm worried about one thing. I need sallylock_mc to stay put on "main" thoughout the movie. For instance, there will be more scenes with the opportunity to put more whoeverlock_mc on "main", and each person will eventually have a lock. I hope that makes sense :)
                                • 13. Re: Remove Movie Clip
                                  kglad Adobe Community Professional & MVP
                                  if you want sally_mc to remain visible no matter what frame your _root timeline plays attach it to _root. if you only want sally_mc to remain visible in the main scene follow the directions just above.
                                  • 14. Re: Remove Movie Clip
                                    elearningdiva Level 1
                                    Thank you!!

                                    :)
                                    • 15. Re: Remove Movie Clip
                                      elearningdiva Level 1
                                      OK, I can't figure out how to create an empty movie clip and make it show sallylock_mc ...help!
                                      • 16. Re: Remove Movie Clip
                                        kglad Adobe Community Professional & MVP
                                        1. in the authoring environment create an empty movieclip.

                                        2. place it on-stage in the frames where you want sallylock_mc to appear and give it an instance name (say, sallylock_holder).

                                        3. right click on sallylock_mc in your library, click linkage, tick export for actionscript, in the id box type sallylock_id and click ok.

                                        4. in the first frame where you want sallylock_mc to appear attach to a frame:

                                        sallylock_holder.attachMovie("sallylock_id","sallylock_mc",sallylock_holder.getNextHighest Depth())
                                        • 17. Re: Remove Movie Clip
                                          elearningdiva Level 1
                                          I'll try that, thanks!!!
                                          • 18. Re: Remove Movie Clip
                                            kglad Adobe Community Professional & MVP
                                            you're welcome.