# Really killing an event, or at least simulating dragOut/Over?

**URL:** <https://forum.kirupa.com/t/really-killing-an-event-or-at-least-simulating-dragout-over/260571>\
**Category:** flash\
**Created:** [May 16, 2008, 9:10pm UTC](https://forum.kirupa.com/t/really-killing-an-event-or-at-least-simulating-dragout-over/260571 "2008-05-16T21:10:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stickeroo](https://avatars.discourse-cdn.com/v4/letter/s/e19adc/32.png) [@Stickeroo](https://forum.kirupa.com/u/Stickeroo)\
**Post date:** [May 16, 2008, 9:10pm UTC](https://forum.kirupa.com/t/really-killing-an-event-or-at-least-simulating-dragout-over/260571/1 "2008-05-16T21:10:39Z")

</div>

I’m sure this is doable through some unholy concoction of event phases and other such alchemies, but it’s beyond my ken at the moment.

I have a button that lives on a touch screen (so there are no traditional rollOver/Out interactions).

If a user holds down on a button, then releases his finger somewhere outside of that button, the stage knows to handle accordingly.

My issue is this: Currently, the user can press a button and move his finger away from it, then move it back over the button, and it’ll fire. Is there a way to prevent this from happening? Rather, is there a way so that when the user drags out of the button, I can ensure that if he moves it back over the button without having released, the button won’t accept it? stopImmediatePropagation() isn’t doing the trick (I thought it would).

Barring this, is there a way to fake a “dragOver” event from the dark ages? I’d greatly appreciate any insight. (I’ve gone through Senocular’s stuff, but I’m apparently too dense to grasp it. ☹ ) Thanks!

---

<div class="post-metadata">

**Author:** ![Anogar](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@Anogar](https://forum.kirupa.com/u/Anogar)\
**Post date:** [May 16, 2008, 10:17pm UTC](https://forum.kirupa.com/t/really-killing-an-event-or-at-least-simulating-dragout-over/260571/2 "2008-05-16T22:17:10Z")

</div>

So, if a user drags their finger off the button, does a MOUSE\_OUT event fire? If so, you could kill the interaction right there.

_edit_:

The reason I ask is that the way to fake dragOver and dragOut is typically by using MOUSE\_OVER and MOUSE\_OUT events:

```auto

myButton.addEventListener(MouseEvent.MOUSE_OUT, dragOut);

function dragOut(e:MouseEvent):void
{
     if (e.buttonDown)
     {
          trace('dragOut');
     }
}

```

---

<div class="post-metadata">

**Author:** ![Stickeroo](https://avatars.discourse-cdn.com/v4/letter/s/e19adc/32.png) [@Stickeroo](https://forum.kirupa.com/u/Stickeroo)\
**Post date:** [May 16, 2008, 10:49pm UTC](https://forum.kirupa.com/t/really-killing-an-event-or-at-least-simulating-dragout-over/260571/3 "2008-05-16T22:49:32Z")

</div>

[quote=Anogar;2327352]So, if a user drags their finger off the button, does a MOUSE\_OUT event fire? If so, you could kill the interaction right there.

_edit_:

The reason I ask is that the way to fake dragOver and dragOut is typically by using MOUSE\_OVER and MOUSE\_OUT events:

```
ActionScript Code:
[LEFT]myButton.[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]MouseEvent.[COLOR=#000080]MOUSE_OUT[/COLOR], dragOut[COLOR=#000000])[/COLOR];

```

[COLOR=#000000] **function** [/COLOR] dragOutCOLOR=#000000[/COLOR]:[COLOR=#0000FF]void[/COLOR]  
[COLOR=#000000]{[/COLOR]  
[COLOR=#0000FF]if[/COLOR] COLOR=#000000[/COLOR]  
[COLOR=#000000]{[/COLOR]  
[COLOR=#0000FF]trace[/COLOR]COLOR=#000000[/COLOR];  
[COLOR=#000000]}[/COLOR]  
[COLOR=#000000]}[/COLOR]  
[/LEFT]

[/quote]

Yeah, there’s a MOUSE\_OUT that fires when the user moves out of the button (and a check to see it the button’s currently down or not), but for some reason, that doesn’t appear to kill everything…though it’s possible I have some extra junk in there that I’ll need to reevaluate…thanks for your input!
