3 Replies Latest reply on Mar 5, 2008 9:14 PM by jameskachan

    basic play and clear movieclip actions AS2 / CS3

    jameskachan Level 1
      CS3
      AS2

      Hi, I have two problems, they seem pretty basic, but i just can't figure out the syntax.

      1. I have a movieclip that stops on frame 5, but i need it to resume when clicked and start playing again on frame 6
      -this is a movie clip, i cant just say something like: (or can I???)

      on (release) {

      gotoAndPlay(6);

      }

      2. Once I get the playhead moving, the code i have now to work requires a click, i would need it to be activated automatically once frame 10 is played ( or a frame label is hit). How do you get a function to activate just when a frame is reached?
      (i need it to unload an external swf)

      var nextimage:String = "";
      //
      function getimage() {
      imgholder_mc.loadMovie(nextimage);
      }
      //

      clear_mc.onPress = function() {
      _level0.imgholder_mc.unloadMovie();
      };



      Your input would be very appreciated.
      I've fought with this for a very long time.

      thanks
      James.
        • 1. Re: basic play and clear movieclip actions AS2 / CS3
          clbeech Level 3
          Hey James -

          1) assuming that this code is attached to the clip who's timeline you wish to move to frame 6, yes this will work. However, it is a 'best practice to maintain all of your codes in one place on the timeline, because the code you indicate above is designed to be 'attached' to an Object. If this is not working, it is probably in the wrong place.

          2) to activate a 'named function' or method that is defined at that point in the timeline, you simply need to make a call to the method, and it will fire when the playhead reaches that point, however since you are calling loadMovie, and loading another clip directly into the same holder, you shouldn't need to actually 'unload' the previous image, as it will be 'replaced' by the next image loading into the same clip.

          • 2. Re: basic play and clear movieclip actions AS2 / CS3
            jameskachan Level 1
            Hello!

            Thanks so much for responding.
            It means a lot, I don't understand this stuff well, I'm a photographer mostly, not a coder.
            anyway, so I tried what you suggested and it did not work.

            The play head will now get past the stop(); at frame 5 and continue to frame 10, However all that happens now on click at frame 10 is the Movie clip replays itself (starting over and stopping at frame 5 again)

            To explain better what I am doing.

            The stage has thumbnail images, on clicking one an external swf is loaded via loadMovie into an empty mc holder on the stage, thus loading in this external swf "on top" of the stage, hiding the thumb gallery.
            I want it so that upon clicking that loaded external movieclip, it will UNLOAD itself from the holder and therefore take the user back to the gallery of thumbnails.

            The empty movie click identifier on the stage is called "imgholder_mc"
            When a thumbnail is clicked, it loads "image1.swf" into the "imgholder_mc"

            This problem relates to what is going on within "imgholder_mc"
            basically I need some actionscript that will unload (and therefore clear) "imgholder_mc" once the playhead reaches frame 10.

            I tried your previous code.. am I using it wrong?
            • 3. Re: basic play and clear movieclip actions AS2 / CS3
              jameskachan Level 1
              Code:

              on frame 10, actions layer, I have this code. (which doenst work of course)
              I am needing this code to reference back to the parent movie so I am (trying) to use
              "_level0" I'm not sure if that's what is wrong or what, all I know is that it doesn't work and all that happens on click is the MovieClip restarts.


              stop();

              var nextimage:String = "";
              //
              function getimage() {
              imgholder_mc.loadMovie(nextimage);
              }
              //

              clear_mc.onPress = function() {
              _level0.imgholder_mc.unloadMovie();
              };
              buttonFour_mc.loadMovie("buttonFour.swf");




              again.. any help would be AMAZING.
              Thanks so much