1 Reply Latest reply on Jun 10, 2015 5:49 AM by kglad

    Play movieClip then Fadeout then Go to next frame

    nelliei

      Actionscript2 Flash CS6

       

      I have a MovieClip on each frame of my main timeline

      Each MovieClip has its own animation

      On the main timeline I want to tell the MovieClip to fade out when finished and go to next frame on main timeline.

      There is no coding anywhere else.

       

      Have tried many different approaches but can’t get both the fade out and continue to next frame to work .

      I can only do one or the other!!

       

      Would love some help! Seems simple logic but struggling!

        • 1. Re: Play movieClip then Fadeout then Go to next frame
          kglad Adobe Community Professional & MVP

          on your first frame add:

           

          findF();

           

          function findF():Void {

              for(var s:String in this){

                  if (typeof (this[s]) == 'movieclip') {

                      trackF(this[s]);

                  }

              }

          }

           

          function trackF(mc:MovieClip):Void{

              this.onEnterFrame = function(){

                  if(mc._currentframe==mc._totalframes){

                      mc.stop();

                      mc.onEnterFrame = fadeF;

                      delete this.onEnterFrame;

                  }

              }

          }

          function fadeF():Void{

              this._alpha-=3;

              if(this._alpha<=0){

                  delete this.onEnterFrame

                  if(this._parent._currentframe<this._parent._totalframes){

                      nextFrame();

                      findF();

                  } else {

                      // end

                  }

              }

          }