Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 457691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T22:35:47+00:00 2026-05-12T22:35:47+00:00

Event.MOUSE_LEAVE is great in Actionscript 3, but it doesn’t seem to fire if the

  • 0

Event.MOUSE_LEAVE is great in Actionscript 3, but it doesn’t seem to fire if the user is holding their left (or right for that matter) mouse button down.

Is there a way to detect if the mouse leaves the Flash movie while the mouse is held down? Or if it is released outside the flash movie?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T22:35:47+00:00Added an answer on May 12, 2026 at 10:35 pm

    To get all of that requires a little bit of a hack. You have to store whether the mouse is off the stage or not and handle the Event.MOUSE_LEAVE event accordingly. Doing it this way gives you all the normal mouse functionality including not stopping the drag just because the mouse went off stage. Since the user might come back on stage and continue the drag it waits ’til the user releases the mouse either on or off stage.

    var mouseOffStage:Boolean;
    
    var bonk:YourDisplayObject = new YourDisplayObject()
    addChild(bonk);
    bonk.addEventListener(MouseEvent.MOUSE_DOWN, function():void {
      mouseOffStage = false;
    
      bonk.startDrag();
    
      stage.addEventListener(MouseEvent.MOUSE_UP, mouseUp);
      stage.addEventListener(Event.MOUSE_LEAVE, mouseLeave);
      stage.addEventListener(MouseEvent.MOUSE_OUT, mouseOut);
      stage.addEventListener(MouseEvent.MOUSE_OVER, mouseOver);
    })
    
    private function mouseUp(e:MouseEvent) :void {
      trace("Mouse Up On Stage")
      bonk.stopDrag()
    }
    
    private function mouseLeave(e:Event) :void {
      if(mouseOffStage){
        trace("mouse up and off stage");
        bonk.stopDrag();
      }else{
        trace("mouse has left the stage");
        //no reason to stop drag here as the user hasn't released the mouse yet
      }
    }
    
    private function mouseOut(e:MouseEvent) :void {
      mouseOffStage = true;
      trace("mouse has left the stage")
    }
    
    private function mouseOver(e:MouseEvent) :void {
      mouseOffStage = false;
      trace("mouse has come back on stage");
    }
    

    The hack is that the MOUSE_LEAVE event, not the MOUSE_UP event, gets fired when the mouse is released off stage so you have to keep track of whether or not the mouse was already off stage when it was released.

    after the drag is finished you of course want to remove all the event listeners associated with detecting mouse-outs and mouse-ups but that code was left out for readability.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 233k
  • Answers 233k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I think you're looking for the xattr command, available in… May 13, 2026 at 5:48 am
  • Editorial Team
    Editorial Team added an answer Inside your style attribute you need to put the following:… May 13, 2026 at 5:48 am
  • Editorial Team
    Editorial Team added an answer Variables and messages live in a different namespace. In order… May 13, 2026 at 5:48 am

Related Questions

Event.MOUSE_LEAVE is great in Actionscript 3, but it doesn't seem to fire if the
I'm building a text input field specialized for entering and editing times. One of
I am struggling with something that I think should be easily (ish). I have
EVENT.DEACTIVATE doesn't work with safari in mac, is there any possible way to do
if i am running my application i want to know where the mouse pointer

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.