5 Replies Latest reply on Mar 6, 2011 3:18 PM by kglad

    Play inverse

    DarioC

      As I use play(); in a button-script to send the timeline head forward in my mc animation, which is the simplest way to tell another button to send the head backwards?

        • 1. Re: Play inverse
          kglad Adobe Community Professional & MVP

          function reverseF(mc:MovieClip,startFrame:Number,endFrame:Number):void{

          mc.gotoAndStop(startFrame);

          mc.onEnterFrame=function(){

          prevFrame();

          if(mc._currentframe==endFrame){

          delete this.onEnterFrame;

          }

          }

          }

          • 2. Re: Play inverse
            DarioC Level 1

            Sorry. Cannot make it happens. Dont know what Im doing wrong. I just copy and paste your code into a button-code-place, but I guess that is not the way. Any tip?

            • 3. Re: Play inverse
              kglad Adobe Community Professional & MVP

              that code should be attached to your swf's first frame.  don't change anything.

               

              whenever you want to play a movieclip (eg, timeline_mc) in reverse from frame 88 to frame 33, use:

               

              reverseF(timeline_mc,88,33);

              • 4. Re: Play inverse
                DarioC Level 1

                Still in trouble. When I run the movie (with your code in the right place) an error message appears in the Compiler Errors window: A type identifier is expected after the ':'  Another issue: the trigger code (reverseF etc) ¿where should I place it to make my button active? Sorry, Im a graphic designer, my skills are far away from scripting language, but Im learning fast with each question answered in this blog.

                • 5. Re: Play inverse
                  kglad Adobe Community Professional & MVP

                  use:

                   

                  function reverseF(mc:MovieClip,startFrame:Number,endFrame:Number):Void{

                  mc.gotoAndStop(startFrame);

                  mc.onEnterFrame=function(){

                  prevFrame();

                  if(mc._currentframe==endFrame){

                  delete this.onEnterFrame;

                  }

                  }

                  }