i have some specific rollovers and today i accidentally discovered some problems.
when butons are overlapping, and when i quickly rollover from bottom one to top one (before bottom one finish its animation), the buttom one doesnt roll out.
also, when i rollover top one, without touching the bottom one, but if mouse is over both ones, the bottom one still fires.
i tried adding e.stopImmediatePropagation(); in 2 places, but it havent fixed all the problems…
first one is still happening, as i see it…
i really dont know what else could i do…
function overMenuItem(e:MouseEvent):void {
** e.stopImmediatePropagation();**
var s2:Sprite = e.target.getChildAt(0) as Sprite;
var s1:Sprite = e.target.getChildAt(1) as Sprite;
var scale:String = e.target.getScaleType();
if (scale == "vertical") {
TweenLite.to(s2, tweenTime, { scaleY: 1, ease: ease });
TweenLite.to(s1, tweenTime, { scaleY: customScale, ease: ease , onComplete: giveRollOut, onCompleteParams: [e.target] });
} else {
TweenLite.to(s2, tweenTime, { scaleX: 1, ease: ease });
TweenLite.to(s1, tweenTime, { scaleX: customScale, ease: ease , onComplete: giveRollOut, onCompleteParams: [e.target] });
}
}
function giveRollOut( target:Sprite ):void {
if (target.mouseEnabled) {
target.addEventListener(MouseEvent.ROLL_OUT, outMenuItem, false, 0, true);
if (!target.hitTestPoint(mouseX, mouseY, true)) {
target.dispatchEvent(new MouseEvent(MouseEvent.ROLL_OUT));
}
}
}
function outMenuItem(e:MouseEvent):void {
**e.stopImmediatePropagation();**
e.target.removeEventListener(MouseEvent.ROLL_OUT, outMenuItem);
var s2:Sprite = e.target.getChildAt(0) as Sprite;
var s1:Sprite = e.target.getChildAt(1) as Sprite;
var scale:String = e.target.getScaleType();
if (scale == "vertical") {
TweenLite.to(s2, tweenTime, { scaleY: customScale, ease: ease });
TweenLite.to(s1, tweenTime, { scaleY: 1, ease: ease });
} else {
TweenLite.to(s2, tweenTime, { scaleX: customScale, ease: ease });
TweenLite.to(s1, tweenTime, { scaleX: 1, ease: ease });
}
}