6 Replies Latest reply on Mar 13, 2007 9:43 AM by BobAchgill

    Loadmovie plays only on 2nd pass

    BobAchgill Level 1
      Why does my movie clip only play the second time I go through this action script? (How I know it plays the second and following times is because I have a button that causes this portion of script to replay.)

      Here is my loadmovie script...

      // display Story annimation
      this.createEmptyMovieClip("Storycanvas_mc", Storycanvas_mc.getNextHighestDepth());
      Storycanvas_mc._visible = false
      Storycanvas_mc._y = 15
      Storycanvas_mc._x = 10
      Storycanvas_mc._xscale = 33
      Storycanvas_mc._yscale = 33

      //Storycanvas_mc.loadMovie(" http://www.helpexamples.com/flash/images/image1.jpg");

      Storycanvas_mc.fscommand2("FullScreen");
      //Storycanvas_mc.loadMovie(this["wordSWF_" + count]);
      Storycanvas_mc.loadMovie("Gen 1.swf");
      Storycanvas_mc._visible = true;

      stop();
        • 1. Re: Loadmovie plays only on 2nd pass
          MotionMaker Level 1
          One item is

          this.createEmptyMovieClip("Storycanvas_mc", Storycanvas_mc.getNextHighestDepth());
          should be
          this.createEmptyMovieClip("Storycanvas_mc", this.getNextHighestDepth());
          and better
          var Storycanvas_mc:MovieClip = this.createEmptyMovieClip("Storycanvas_mc", this.getNextHighestDepth());

          • 2. Re: Loadmovie plays only on 2nd pass
            mclem Level 1
            I would use the movieclip loader class if I were you, it gives you more control and feedback over loading a new movie. in flash open the help panel and type MovieClipLoader in the search bar and find the excellent example in the ActionScript Language Reference. It will allow you to track whether your object was loaded correctly when it is finished loading, etc. Then you can set the properties of the clip once the clip has completed loading.

            MarkC
            • 3. Re: Loadmovie plays only on 2nd pass
              BobAchgill Level 1
              quote:

              var Storycanvas_mc:MovieClip = this.createEmptyMovieClip("Storycanvas_mc", this.getNextHighestDepth());


              Yes, this works, too, on the 2nd pass ONLY and subsequent rerunning the through the script by pressing my special rerun the script button.

              Could it be that this is a timing issue or a keyframe issue? Do I need to give sufficient amount of frames for the movie to load before I interject the stop command on the final frame? Or something related to use of keyframes?

              I successfully use the same code else where and it runs on the first pass. But that is a place where I have more frames following the loadmovie script before the stop command.
              • 4. Re: Loadmovie plays only on 2nd pass
                BobAchgill Level 1
                "movieclip loader class" does the same thing... only plays on the second pass.
                • 5. Re: Loadmovie plays only on 2nd pass
                  Level 1
                  Hey,

                  As soon as you do this: Storycanvas_mc.loadMovie("Gen 1.swf");
                  All your settings for Storycanvas_mc are lost, becuase the loading Movie replaces the current one - properties and all!

                  This should be fixed using the MovieClipLoader... so don't understand why it's not?

                  Could you give us the code example with the loader implementation?

                  Also, your fscommand should be of this format: fscommand2("FullScreen", true); - and it is not a method of the MovieClip class, so doesn't need the 'Storycanvas_mc.' prefix. You should also do some testing of the return value, just in case it's not supported.

                  Cheers,
                  Osh...
                  • 6. Re: Loadmovie plays only on 2nd pass
                    BobAchgill Level 1
                    Oh! I am sorry guys... i found that I was updating the wrong frame. No wonder the code was not firing.
                    Thanks for walking me through this.