AS3 Crazy Drop Down Menu Jittery Issue
I have a few flash errors on my website. I started playing around with AS3 and created a list that expands when mouse is over and goes down when mouse is out. Kind of like a drop down menu. Problem is sometimes it acts really spastic. Anyone have any solutions?
Here is my website... www.allencoded.com
Below it my code..
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
import flash.events.Event;
import flash.ui.Mouse;
import flash.net.URLRequest;
stop();
FeedBox.mouseChildren=false;
ProjectBox.mouseChildren=false;
//FeedBox Tween Stuff----------------------
var feedup:Tween = new Tween(FeedBox, "y", Strong.easeOut, 560, 290, 2, true);
var feeddown:Tween = new Tween(FeedBox, "y", Strong.easeOut, 290, 560, 2, true);
FeedBox.addEventListener(MouseEvent.MOUSE_OVER, mouseyOnFeed);
FeedBox.addEventListener(MouseEvent.MOUSE_OUT, mouseyOutBox);
function开发者_JAVA技巧 mouseyOnFeed(e:Event){
feedup.start();
}
function mouseyOutBox(e:Event){
feeddown.start();
}
//ProjectBox Tween stuff------------------------
var projectleft:Tween = new Tween(ProjectBox, "x", Strong.easeOut, 920, 565, 2, true);
var projectright:Tween = new Tween(ProjectBox, "x", Strong.easeOut, 565, 920, 2, true);
ProjectBox.addEventListener(MouseEvent.MOUSE_OVER, mouseyOnProj);
ProjectBox.addEventListener(MouseEvent.MOUSE_OUT, mouseyOutProj);
function mouseyOnProj(e:Event){
projectleft.start();
}
function mouseyOutProj(e:Event){
projectright.start();
}
//BLOG BUTTON
Blog.addEventListener(MouseEvent.CLICK, toBlog);
function toBlog(e:Event){
var blogaddy:URLRequest = new URLRequest("http://www.allencoded.com/blog");
navigateToURL(blogaddy);
}
function mouseyOnProj(e:Event){
projectleft.start();
ProjectBox.removeEventListener(MouseEvent.MOUSE_OVER, mouseyOnProj);
}
function mouseyOutProj(e:Event){
projectright.start();
ProjectBox.removeEventListener(MouseEvent.MOUSE_OUT, mouseyOutProj);
}
i would prefer to remove events while tweening and onCompletes addEventListeners back. Btw out source tweeners performes better for tweenings.
Ask again if you need more information.
The problem seems to be happening when the tab reaches the mouse cursor, causing the mouse to enter it before it has finished moving. Try
function mouseyOnProj(e:Event){
if (!projectleft.isPlaying) projectleft.start();//
}
function mouseyOutProj(e:Event){
if (!projectright.isPlaying) projectright.start();//
}
精彩评论