-
Problem with ROLL_OVER and ROLL_OUT
I am trying to make something simple in Flash but it doesn't work properly. I want to increase an image with mouse ROLL_OVER and decrease with ROLL_OUT. I have an instance of a button on the scene with name - my_box
and x=100; y=100;
This is my code:
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
var myTween1:Tween;
var myTween2:Tween;
var myTween3:Tween;
var myTween4:Tween;
var myTween5:Tween;
var myTween6:Tween;
var myTween7:Tween;
var myTween8:Tween;
var img:Object;
function increase(e:MouseEvent):void {
img = e.currentTarget;
myTween1 = new Tween(img, "x", Regular.easeOut, 100, 25, 2, true);
myTween2 = new Tween(img, "y", Regular.easeOut, 100, 25, 2, true);
myTween3 = new Tween(img, "width", Regular.easeOut, 50, 200, 2, true);
myTween4 = new Tween(img, "height", Regular.easeOut, 50, 200, 2, true);
}
function decrease(e:MouseEvent):void {
img = e.currentTarget;
myTween5 = new Tween(img, "x", Regular.easeOut, 25, 100, 2, true);
myTween6 = new Tween(img, "y", Regular.easeOut, 25, 100, 2, true);
myTween7 = new Tween(img, "width", Regular.easeOut, 200, 50, 2, true);
myTween8 = new Tween(img, "height", Regular.easeOut, 200, 50, 2, true);
}
my_box.addEventListener(MouseEvent.ROLL_OVER, increase);
my_box.addEventListener(MouseEvent.ROLL_OUT, decrease);
It works, but in some positions of cursor the image trembles.
-
You are tweening the same object that you're animating - so when you get to the edge it jumps between animating the thing out from under your mouse and back...Try using a clear button for your hotspot and tween your graphics directly underneath.
Please use [php] or [code] tags, and mark your threads resolved 8)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|