9 Replies Latest reply on Apr 17, 2006 7:03 PM by Rothrock

    Problem with unload movie

    chess4thestupid Level 1
      Hey,

      In my flash movie I am loading a video player into level2... but when I click the button that unloads the movie from level 2... the sound continues to play even though that level has been unloaded... I tried using the stopAllSounds command... but I'm not sure how to tell it to target level2 from level0....

      any ideas...

      Thanks in advance for any help...

      -chess4
        • 1. Re: Problem with unload movie
          Rothrock Level 5
          This was such a popular topic a while ago, hard to believe that we haven't seen it for awhile.

          If you are playing a video (by video you mean FLV, right?) then you should Media.stop() the video. I don't think stopAllSounds will work since you aren't directly using the Sound class.

          If you don't know how to target _level2, how are you unloading it?
          • 2. Re: Problem with unload movie
            chess4thestupid Level 1
            I am using code like this

            back.onRelease=function(){
            unloadMovie(2);
            gotoAndPlay(1);
            }


            So would I do this??
            back.onRelease=function(){
            Media.stop(2)
            unloadMovie(2);
            gotoAndPlay(1);
            }

            because I need to stop it as well as unload the swf it is playing in on level 2


            and yes it is an FLV..


            • 3. Re: Problem with unload movie
              chess4thestupid Level 1
              Also..

              Thanks a lot... everyone on this forum is so helpful.. I have learned so much just from reading all the posts..

              • 4. Re: Problem with unload movie
                Rothrock Level 5
                Ah. I forgot about using unloadMovie in that way. I think If you are unloading a level you should use unloadMovieNum(2).

                To reference any level, you start the reference to object with _levelX (where X is the number of the level.)

                _level2.Media.stop()

                Should do it, assuming Media is on the main timeline of the swf that is loaded into level 2.
                • 5. Re: Problem with unload movie
                  chess4thestupid Level 1
                  I tried this

                  back.onRelease=function(){
                  _level2.Media.stop();
                  unloadMovie(2);
                  gotoAndPlay(1);
                  }

                  but still nothing

                  the media is on the first frame of the main timeline in the SWF on level2

                  I'm sorry but I am really a novice at code and mainly do design..

                  if my code looks retarded please excuse it.

                  WHAT AM I DOING WRONG???????????

                  Thanks sooooooo much for your help... you ever have an after FX photoshop or 3dmax question you let me know.
                  • 7. Re: Problem with unload movie
                    Rothrock Level 5
                    And you are sure that you have given the Media playback component the instance name of "Media" because if you have it should work.

                    Also, please read my posts a bit more carefully. If you are using levels, you should use unloadMovieNum().

                    Are you sure that the back button is working as well? Add this line just before the stop line.

                    trace("Back button pressed.");
                    • 8. Re: Problem with unload movie
                      chess4thestupid Level 1
                      It finally works... I had somehow messed up and named it "meedia"


                      You said I should use this "unloadMovieNum()." instead of "unloadMovie(2);" they both work...

                      Just curious what the difference is... I just can't tell

                      Rothrock.... YOU ROCK
                      • 9. Re: Problem with unload movie
                        Rothrock Level 5
                        The loadMovieNum and unloadMovieNum (notice the word Num at the end) should be used whenever you are using _level. While they will sometimes work with the non-Num versions, it can also cause subtle problems that will make you crazy. So it is good to use the correct version.

                        Glad that worked out for you. So the big lesson learned is that YOU DO KNOW what you are doing! Have confidence in your code and check for the silly obvious mistakes that we all make from time to time. We have all had the "instance name isn't what we thought, how could that have happened" trouble more than we can count. The trick is to learn from it after the 1000th time!