|
-
[AS3][CS4]Rollout functions not always working...
So, I have these little menu tags which move down when you roll over them. then, if you click one, it stays down. then the other menu tags move down when you roll over them, until you click one, at which point the previous tab moves back to original position. (i'm sure that makes little to no sense... so look here:
http://www.teaindreamland.co.uk/samples/flash.html
anyway, it works great for the first couple of seconds, then after a while (especially after a click) some of the menu's don't return to their previous position.
my fla is attached, but here is my script
PHP Code:
//import classes
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
import flash.display.MovieClip;
//tab controls
var currentTab:Object = dummy;
tab1.addEventListener(MouseEvent.ROLL_OVER, over);
tab2.addEventListener(MouseEvent.ROLL_OVER, over);
tab3.addEventListener(MouseEvent.ROLL_OVER, over);
tab1.addEventListener(MouseEvent.ROLL_OUT, out);
tab2.addEventListener(MouseEvent.ROLL_OUT, out);
tab3.addEventListener(MouseEvent.ROLL_OUT, out);
tab1.addEventListener(MouseEvent.CLICK, select);
tab2.addEventListener(MouseEvent.CLICK, select);
tab3.addEventListener(MouseEvent.CLICK, select);
function over(evt:MouseEvent):void
{
var currentPos = evt.target.y;
var tweenOver = new Tween(evt.target, "y", Strong.easeOut, currentPos, 0, 0.5, true);
}
function out(evt:MouseEvent):void
{
var currentPos = evt.target.y;
var tweenOut = new Tween(evt.target, "y", Strong.easeOut, currentPos, -23, 0.5, true);
}
function select(evt:MouseEvent):void
{
var currentPos =currentTab.y;
var tweenOut = new Tween(currentTab, "y", Strong.easeOut, currentPos, -23, 0.5, true);
currentTab.addEventListener(MouseEvent.CLICK, select);
currentTab.addEventListener(MouseEvent.ROLL_OVER, over);
currentTab.addEventListener(MouseEvent.ROLL_OVER, over);
currentTab = evt.target;
evt.target.removeEventListener(MouseEvent.CLICK, select);
evt.target.removeEventListener(MouseEvent.ROLL_OUT, out);
evt.target.removeEventListener(MouseEvent.ROLL_OVER, over);
}
Thank you so much Flashkit!!
Tags for this Thread
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
|