Jump to content
Search Community

What is the command to reset the TweenMax to play again

ngrinchenko test
Moderator Tag

Recommended Posts

I play my Tween on MOUSE_OVER.

Then I would like it to be reset on MOUSE_OUT so when there is a MOUSE_OVER again on that MC - it plays again.

	ACOLYTE_mc.ACOLYTE_logo_btn.ACOLYTE_flash.alpha = 0;
	var  ACOLYTE_flash_Tween:TweenMax = TweenMax.fromTo(ACOLYTE_mc.ACOLYTE_logo_btn.ACOLYTE_flash, .25, {scaleX:.1, scaleY:.1},{scaleX:1, scaleY:.4, alpha:1, glowFilter:{color:0xffffff, alpha:1, blurX:12, blurY:5, strength:5, quality:3}, blurFilter:{blurX:12, blurY:4, quality:3}, repeat:1, yoyo:true, paused:true});

	ACOLYTE_mc.ACOLYTE_logo_btn.addEventListener(MouseEvent.ROLL_OVER, overHandler_ACOLYTE_logo_btn);
	ACOLYTE_mc.ACOLYTE_logo_btn.addEventListener(MouseEvent.ROLL_OUT, outHandler_ACOLYTE_logo_btn);
		 
		 
	function overHandler_ACOLYTE_logo_btn(e:MouseEvent):void{
         ACOLYTE_flash_Tween.play();
         trace("you rolled over me");
         }
         
	function outHandler_ACOLYTE_logo_btn(e:MouseEvent):void{
         ACOLYTE_flash_Tween.restart();
         trace("you rolled off me");
         }		

 

 

I want the tween to play only once on MOUSE_OVER each time the mouse is over that mc. On MOUSE_OUT nothing happens on the screen just the tween is being reset to play again.

In my set up it plays again

Link to comment
Share on other sites

v12: pass a time of 0 into the pause() method

 

 

 

 function outHandler_ACOLYTE_logo_btn(e:MouseEvent):void{
         ACOLYTE_flash_Tween.pause(0);
         trace("you rolled off me");
         }   
 

v11

 

function outHandler_ACOLYTE_logo_btn(e:MouseEvent):void{
         ACOLYTE_flash_Tween.currentTime = 0;
         ACOLYTE_flash_Tween.pause()
         trace("you rolled off me");
         }   
 

 

Link to comment
Share on other sites

If you use restart() it will work, I'm not 100% sure why play() wasn't.

 

 

    function overHandler_ACOLYTE_logo_btn(e:MouseEvent):void{
         ACOLYTE_flash_Tween.restart();
         trace("you rolled over me");
         }
        
    function outHandler_ACOLYTE_logo_btn(e:MouseEvent):void{
         ACOLYTE_flash_Tween.currentTime = 0;//restarts the tween from 0
         ACOLYTE_flash_Tween.pause();//restarts the tween from 0
         trace("you rolled off me");
         } 
 
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...