5 Replies Latest reply on Mar 29, 2007 5:05 PM by bvillanyi

    Can' get movie clip to play

    bvillanyi
      I have a Flash movie that plays a movie clip called DR1 at frame 113 using this code:

      DR1.play();

      There is nothing else going on in the movie for the length of the clip, but when I play the movie, the clip does not play - I just have a blank screen for those frames.

      Also, if I try dragging an instance of the movie onto the timeline at that point, the same thing happens - blank screen for the amount of frames that the clip is present.

      If I play the clip in the library it plays correctly.

      What am I doing wrong?

      Thanks,
      Beth

        • 1. Re: Can' get movie clip to play
          liquidleaf
          The clip does have to be in the timeline to play as you are trying to do. The code cannot occur unless the playback head is where the movie exists. If you try to call DR1.play() at a point where the movieClip does not yet exist on the stage, nothing will happen.

          Otherwise, if the movieclip isn't on stage, you have to use actionscript to create an instance of it.

          Hard to tell what else might be wrong without more information.
          • 2. Re: Can' get movie clip to play
            bvillanyi Level 1
            OK - I realize now that I have to actually publish the movie to have the clip play, whether by dragging an instance onto the timeline or loading it via AS.

            Now I have another issue. I'm sorry if these are stupid questions, but I have a hard time finding things in the help file - maybe I'm too much of a new Flash user to understand what to look for!

            Anyway, when I play the movie, I have three problems:

            1) the clip starts playing immediately, even though I don't issue the play() command until the middle of the movie. I do the attachMovie in the first frame so that it has loaded by the time I want to play it, but it starts playing right away even though I don't tell it to play.

            2) the clip seems to be centered on the upper left corner of the screen when it plays. I have tried setting the _x and _y properties of the instance to 0,0 but that doesn't seem to make a difference. I want the clip to be centered on the screen (it is sized to take up the whole stage) but can't seem to move it no matter what values I plug into the _x and _y properties.

            3) the clip loops continuously. I only want it to play once but can't seem to find a property to control the looping.

            Here is the code in the first frame:

            var mc1:MovieClip;
            mc1 = this.createEmptyMovieClip("DR1", this.getNextHighestDepth());
            this.attachMovie("DR1", "mc1", this.getNextHighestDepth());
            mc1._x = 500;
            mc1._y = 500;

            mc1.stop(); (this was added to get it to not play until later, to no avail)

            And the code at frame 113:
            mc1.play();

            And finally at frame 412:
            mc1.stop();


            Help, please!

            Thanks,
            Beth
            • 3. Re: Can' get movie clip to play
              Denatram
              Beth, Here's a little help.....

              3- You will need to have a stop action on the last frame of your movie clip, otherwise it will loop on the main timeline.
              • 4. Re: Can' get movie clip to play
                Denatram Level 1
                Try something more like this: (This assumes DR1 is the name of your movie clip)


                this.createEmptyMovieClip("mc1", getNextHighestDepth());
                mc1.attachMovie("DR1");
                mc1._x = 500;
                mc1._y = 500;

                Put a stop(); in the first frame of your movie clip and at the frame in the main timeline where you want it to start (113 in this case) put:
                mc1.play();

                Since you will have put a stop(); at the end of the movie clip it will stop on its own.

                • 5. Re: Can' get movie clip to play
                  bvillanyi Level 1
                  Okay, your first suggestion, to put a stop() in the last frame of the clip, worked. Thanks.

                  But putting a stop in the first frame of the clip makes it stop, but it never restarts when it gets to the play() in frame 113.

                  And I still have the issue with placement on the stage.

                  Please help!

                  Thanks,
                  Beth