I have the following code:
time = 10;
easeType = mx.transitions.easing.Regular.easeOut;
endNumber = 400;
longStrip._visible = false;
button1.onRollOver = function()
{
longStrip._visible = true;
myAlphaTween = new mx.transitions.Tween(longStrip, "_alpha", easeType, 0, 100, time, false);
myXTween = new mx.transitions.Tween(longStrip, "_x", easeType, longStrip._x, endNumber, time, false);
};
longStrip.onRollOut = longStrip.onReleaseOutside = function()
{
myAlphaTween = new mx.transitions.Tween(longStrip, "_alpha", easeType, 100, 0, time, false);
myXTween = new mx.transitions.Tween(longStrip, "_x", easeType, longStrip._x, 0, time, false);
myXTween.onMotionFinished = function()
{
longStrip._visible = false;
}
}
Also, see the attached FLA.
What I want:
-
The mouse is put over the button. The a graphic moves below the button from the left. The graphic comes from an alpha of zero to 100 when it finishes moving.
-
The mouse moves outside of the graphic. The graphic moves back to where it came from and dissapears.
I have a few problems with my code.
-
The graphic moves under the button. If the mouse goes over the graphic and then goes back on the button again, the alpha tween I have gets invoed again.
To over come this, I could set a variable and then have an ‘if’ clause.
But, is this the best way? -
The graphic moves under the button. When I press the mouse down, hold it down and move the mouse outside of the graphic, the graphic doesn’t go back to where it came from.
I could overcome this by having a giant button or movie that covers everything except the graphic when it comes under the button.
Is this the best way? -
If the mouse is moved over the button really fast, and outside the graphic, the graphic stays there. In intention is to have the graphic not under the button when it is outside.
Please see the FLA see the above in action.
Any help would be appreciated.
Thanks.
OM