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 806141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T00:11:51+00:00 2026-05-15T00:11:51+00:00

I have the bad luck of having to downport some ActionScript 3 code to

  • 0

I have the bad luck of having to downport some ActionScript 3 code to ActionScript 2 and I have a problem with detecting when the mouse leaves the stage.

In ActionScript 3 there is an event called Event.MOUSE_LEAVE, which can be used to detect when the mouse leaves the stage, but there is no equivalent in ActionScript 2 as far as I can see.

How would you best emulate the same functionality?

Listening for mouse movement and checking the mouse coordinates against the bounds of the stage doesn’t work because the mouse coordinates stop updating when the mouse leaves the stage.

  • 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-15T00:11:52+00:00Added an answer on May 15, 2026 at 12:11 am

    Using math to estimate when the mouse will be out of bounds:

    (An implementation along the lines of Theo’s 3rd option.)

    // Stage rollout detection:
    private var mouse_dx:Number;
    private var mouse_dy:Number;
    
    private function detectMouseOutOfBounds ():Void {
        mouse_dx = _xmouse;
        mouse_dy = _ymouse;
    
        var mouseListener:Object = { };
        mouseListener.onMouseMove = Delegate.create(this,
            function () {
                mouse_dx = Math.abs(mouse_dx-_xmouse);
                mouse_dy = Math.abs(mouse_dy-_ymouse);
                var speed:Number = Math.max(mouse_dx, mouse_dy) + 5; // Precautionary buffer added.
                var willBeOutOfBounds:Boolean = (
                    _xmouse - speed < 0 || 
                    _xmouse + speed > Stage.width ||
                    _ymouse - speed < 0 ||
                    _ymouse + speed > Stage.height
                );
                if (willBeOutOfBounds) {
                    _display._alpha = 10;
                } else {
                    _display._alpha = 100;
                }
                mouse_dx=_xmouse;
                mouse_dy = _ymouse;
            }
        );
        Mouse.addListener(mouseListener);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having some bad luck trying to bind a uniform 4x4 matrix. I'm targeting
I seem to have some bad luck getting any events beyond formX_load(..) to run.
I become use raw socket and i have this problem: bad file descriptor the
I'm having surprisingly bad luck finding a decent resource for this. But What I'm
i hat one task, and know i have to continue but have a bad
I need help getting git extensions to run with msysgit. I have had bad
Unfortunately I have a pretty bad understanding of how to properly set up threading.
I have clients with really bad networks, including bad mappings at the gateways and
Is it bad practice to have a custom cursor on a website? Not just
I have the string: i am a bad boy. I want to convert that

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.