4 Replies Latest reply on Dec 30, 2006 6:45 AM by jsg5403

    Day 10 all I want to do is close a movie

    jsg5403
      Ok,

      I decided to make a new topic. I have been trying everything and I still can't make this work.

      I made a web page that has a bunch of buttons that when rolled over shows an image and when clicked opens a video player on layer 50 over the image. I can not figure out how to make the movie(flv player in swf file) either just unload and stop when the flv player is done or close and stop when I hit a premade button that has the correct code from a tutorial book.

      I have the flv file set as a progressive download in a seperate swf file and by using a premade button from the Lynda flash 8 book the button closes but the flv keeps playing which it shouldn't.

      My ultimate goal is to have the swf movie with the FLV file to close as soon as the FLV file is finished playing.

      Here's the Code for the swf file with the new close button.
      on (release) {
      unloadMovieNum(50);
      }

      Here's the code for the main site:
      stop();

      button1_btn.onRollOver = function(){
      gotoAndstop(2);
      }

      button1_btn.onRelease = function(){
      loadMovieNum("movieplayer1.swf", 50);
      }

      I'm starting to go crazy any help would be much appreciated.

      Jason
        • 1. Re: Day 10 all I want to do is close a movie
          Rothrock Level 5
          First it is _level50, not layer. A layer is a tool for organizing your artwork in the authoring environment. Layers don't exist once you have published your swf file. (I know you didn't ask, but really in the long run something like this is important to nip in the bud so to speak!)

          Now on to your actual question. You say "…but the flv keeps playing, which it shouldn't." Why shouldn't it? You haven't told it to stop. Ideally Flash would realize that there is a FLV player in movieplayer1.swf (loaded into _level50) and it would stop it and remove it all before you do unloadMovieNum(50).

          BUT as you have learned, it doesn't. You've almost hit upon the answer in your second paragraph. You don't want it to unload and stop, you MUST stop it and then unload.

          Something along the lines of:

          _level50.myPlayer.stop();

          I think that should do it.

          As for the part about having it unload itself when it reaches the end. You should check the help files for the Media component. There you will find the Media.complete event and how to use it.
          • 2. Re: Day 10 all I want to do is close a movie
            jsg5403 Level 1
            Thanks for the help so far.

            I seem to be a little confused and I might need a little hand holding to figure this out.

            I know I can make the movie unload now I'm trying to get the movie to stop first so
            I took the code you gave me and tried this.

            on (release) {
            level50.testmovieflash.flv.stop();
            }

            and took out the previous code on the swf file for the player itself and It doesn't stop the player

            I know that I'm not writing the code right what should it be to work?

            I made the player component window instance (myPlayer) the actual flv file name is (testmovieflash.flv)

            Thanks again for your help. I plan on getting a good Action script beginners book ASAP!! can you recommend one?
            • 3. Re: Day 10 all I want to do is close a movie
              Rothrock Level 5
              First you need the underscore. It is _level50 not level50.

              The name of the swf or the flv isn't important (for this purpose anyways), what is important is the name you have given your media component. If you haven't given it one then that is the problem. Open the player FLA, select the media component instance, and check the properties pane. There you will see a place to put the name.

              Remember that capitalization matters.

              Also the stop() part will only stop it. You will then need to unLoadNum() that level as well.

              I don't really know any good beginners books. I started with Flash 4, so I don't think those would really help you.

              The best thing is to use the help files – BELIEVE IT OR DON'T!!!! The trick is to almost never use the search. For example, when you decided that you wanted to use a media component you should look in the Media Components dictionary and read every entry there. That will tell you what can be done with the Media component.
              • 4. Re: Day 10 all I want to do is close a movie
                jsg5403 Level 1
                I wanted to thank you and tell you that this time it worked. I have been looking through the help menu but I seem to be having other issues probably not related to my programing such as when I type in code for whatever reason Flash doesn't alway's accept it and doesn't act correctly. This happened when I created a preloader and some how even though I had a background and vector text on the first frame claimed I had over 600k of info. I started from scratch and It came out with only 4k.

                I guess after a good reboot and a good night sleep things work out.

                Thanks again.

                jason