# stopImmediatePropagation

**URL:** <https://forum.kirupa.com/t/stopimmediatepropagation/297464>\
**Category:** flash\
**Created:** [October 2, 2009, 1:59pm UTC](https://forum.kirupa.com/t/stopimmediatepropagation/297464 "2009-10-02T13:59:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![regbolD](https://avatars.discourse-cdn.com/v4/letter/r/ecccb3/32.png) [@regbolD](https://forum.kirupa.com/u/regbolD)\
**Post date:** [October 2, 2009, 1:59pm UTC](https://forum.kirupa.com/t/stopimmediatepropagation/297464/1 "2009-10-02T13:59:26Z")

</div>

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…

```auto

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 });

    }
}

```
