Skip to main content
January 23, 2010
Question

ROLL_OVER and ROLL_OUT producing unwanted results...help?

  • January 23, 2010
  • 1 reply
  • 361 views

I want to create a MovieClip button that when the mouse rolls over it, it scales larger and then when the mouse rolls out of it, it scales back to normal size.


If i move the mouse cursor over and out of it slowly, the animation is fine, but if enter the mouse over it on one side and out on the other side or jerk my mouse around it acts as if the EventListeners and their respective Tween code has been reversed. I have even seen on occasion the square filling the whole screen.


Here's my code:
(this is written from memory and not copy pasted from flash, but before you say anything, I do have the proper imports for classes in the code so I won

var yTween:Tween = new Tween(myMc, "scaleY", Elastic.easeOut, 1, 2, 2, true);
yTween.stop();

myMc.buttonMode = true;
myMc.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler);
myMc.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler);
function onRollOverHandler (myevent:MouseEvent) {
       yTween.start();
      
}
function onRollOutHandler (myevent:MouseEvent) {
       yTween.yoyo();
      
}

t include them here.


It is important to note that when I Tween other properties like transparency or alpha or color, everything is fine...this just happens when there is movement or scaling or animation in involved.


any help would be GREATLY appreciated since i have been stuck on this for awhile!
Thanks

This topic has been closed for replies.

1 reply

January 23, 2010

Ignore the function at the very top of my code quote, that was inserted by the forums for some odd reason.

Ned Murphy
Legend
January 23, 2010

I am not a Tween wizard, but to accomplish what you say you want to do, I would normally attack it as follows...

import fl.transitions.Tween;
import fl.transitions.easing.*;

myMc.buttonMode = true;
myMc.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler);
myMc.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler);

var yTween:Tween;

function onRollOverHandler (myevent:MouseEvent) {
     yTween = new Tween(myMc, "scaleY", Elastic.easeOut, myMc.scaleY, 2, 2, true);
}

function onRollOutHandler (myevent:MouseEvent) {
     yTween = new Tween(myMc, "scaleY", Elastic.easeOut, myMc.scaleY, 1, 2, true);
}