Jump to content
Search Community

MOUSE_OUT reset

joakimhoegset test
Moderator Tag

Recommended Posts

Hi I am sure this is quite easy but I need help.

I want to have a movieclip animate from

x:115 to 205

and

y:55 to 33

This action should be on MOUSE_OVER and yoyo back and forth when the mouse is over a button. When the mouse is out of the button is should go from where it is currently and back to x:115 y:55.

 

How do I do this?

 

Thanks for any help.

 

Joakim

Link to comment
Share on other sites

import com.greensock.*;
import flash.events.MouseEvent;

myButton.addEventListener(MouseEvent.ROLL_OVER, overHandler);
myButton.addEventListener(MouseEvent.ROLL_OUT, outHandler);

function overHandler(event:MouseEvent):void {
   TweenMax.to(myButton, 1, {x:205, y:33, onComplete:startYoyo});
}

function startYoyo():void {
   TweenMax.to(myButton, 1, {x:115, y:55, repeat:-1, yoyo:true});
}

function outHandler(event:MouseEvent):void {
   TweenMax.to(myButton, 1, {x:115, y:55});
}

 

Feel free to add different easing and alter the duration of the tweens.

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...