1 Reply Latest reply on Oct 7, 2010 11:07 PM by kglad

    Want TimerEvent to pause between functions AS3

    sdcowart Level 1

      Dear users,

       

      I would like to somehow pause between the "doEvent" function and the "event2" function. I have the event2 function starting at motion finish after 1.5 seconds but it needs to be longer without changing any of the tweens.  I've looked up the pause method and can't figure out how to implement this. See code below

       

      Please lend some insight if you can. I have a work-around but would like to know if there is a way.

       

      Thanks!!!

      Steve

       

      function doEvent(evt:TimerEvent):void{

      myTimer.removeEventListener(TimerEvent.TIMER,doEvent);

      myGreatDeals1Photo.visible = true;

      myGreatDeals1Photo.x=80;

      myGreatDeals1Photo.y=89.3;

      myGreatDealsTxt.visible=true;

      myGreatDealsTxt.x=80;

      myGreatDealsTxt.y=465;

      greatDealsPhoto1Tween = new Tween(myGreatDeals1Photo,"alpha",Regular.easeIn,0,1,.5,true);

      greatDealsTxtTween = new Tween(myGreatDealsTxt,"alpha",Strong.easeIn,0,1,1.5,true);

      greatDealsTxtTween.addEventListener(TweenEvent.MOTION_FINISH,event2);

       

      }

       

      function event2(evt:TweenEvent):void{

      greatDealsTxtTween.removeEventListener(TweenEvent.MOTION_FINISH,event2);

      myDailyBreakfastPhoto.visible = true;

      myDailyBreakfastPhoto.x=80;

      myDailyBreakfastPhoto.y=86.3;

      myDailyBreakfastTxt.visible=true;

      myDailyBreakfastTxt.x=83.75;

      myDailyBreakfastTxt.y=453.05;

      dailyBreakfastPhotoTween = new Tween(myDailyBreakfastPhoto,"alpha",Regular.easeIn,0,1,.5,true);

      dailyBreakfastTxtTween = new Tween(myDailyBreakfastTxt,"alpha",Strong.easeIn,0,1,1.5,true);

       

      greatDealsPhoto1Tween = new Tween(myGreatDeals1Photo,"alpha",Regular.easeIn,1,0,.5,true);

      greatDealsTxtTween = new Tween(myGreatDealsTxt,"alpha",Regular.easeIn,1,0,.5,true);

      //greatDealsTxtTween.addEventListener(TweenEvent.MOTION_FINISH,event3);

      }

        • 1. Re: Want TimerEvent to pause between functions AS3
          kglad Adobe Community Professional & MVP

          :

           

           


           

          function doEvent(evt:TimerEvent):void{

          myTimer.removeEventListener(TimerEvent.TIMER,doEvent);

          myGreatDeals1Photo.visible = true;

          myGreatDeals1Photo.x=80;

          myGreatDeals1Photo.y=89.3;

          myGreatDealsTxt.visible=true;

          myGreatDealsTxt.x=80;

          myGreatDealsTxt.y=465;

          greatDealsPhoto1Tween = new Tween(myGreatDeals1Photo,"alpha",Regular.easeIn,0,1,.5,true);

          greatDealsTxtTween = new Tween(myGreatDealsTxt,"alpha",Strong.easeIn,0,1,1.5,true);

          greatDealsTxtTween.addEventListener(TweenEvent.MOTION_FINISH,event2a);

           

          }

          function event2a(e:TweenEvent){

          setTimeout(event2,2000);

          }

           

          function event2():void{

          greatDealsTxtTween.removeEventListener(TweenEvent.MOTION_FINISH,event2 );

          myDailyBreakfastPhoto.visible = true;

          myDailyBreakfastPhoto.x=80;

          myDailyBreakfastPhoto.y=86.3;

          myDailyBreakfastTxt.visible=true;

          myDailyBreakfastTxt.x=83.75;

          myDailyBreakfastTxt.y=453.05;

          dailyBreakfastPhotoTween = new Tween(myDailyBreakfastPhoto,"alpha",Regular.easeIn,0,1,.5,true);

          dailyBreakfastTxtTween = new Tween(myDailyBreakfastTxt,"alpha",Strong.easeIn,0,1,1.5,true);

           

          greatDealsPhoto1Tween = new Tween(myGreatDeals1Photo,"alpha",Regular.easeIn,1,0,.5,true);

          greatDealsTxtTween = new Tween(myGreatDealsTxt,"alpha",Regular.easeIn,1,0,.5,true);

          //greatDealsTxtTween.addEventListener(TweenEvent.MOTION_FINISH,event3) ;

          }