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

  • SEARCH
  • Home
  • 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 6934673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:59:27+00:00 2026-05-27T11:59:27+00:00

I have something really weird going on in my project (Flash CS5.5 and AIR

  • 0

I have something really weird going on in my project (Flash CS5.5 and AIR 3…)

I need to check (for my own good reasons) whether the cursor is located within the bounds of a particular object. I’m using a simple code to do this…

if(mouseX > hsSlot1.x && mouseX < (hsSlot1.x + hsSlot1.width) && mouseY > hsSlot1.y && mouseY < (hsSlot1.y + hsSlot1.height))
    {
        //My code
    }

This, theoretically, should work perfectly! However, there is an offset (and one I did NOT set, mind you!) of about 16 between the hsSlot1’s visual position (where it appears to start on the screen) and hsSlot1.x. There is a similar offset on the y axis, but I haven’t measured it yet.

The only thing I can think of for this is that hsSlot1 is an instance of a button (one with only one state at that) that was scaled to fit. However, I don’t think that is it, because the numbers show that the entire object is merely offset at its current size.

What the devil is going on?

EDIT: I found another way of doing this that wasn’t working at first. However, an answer would still be appreciated, as this type of thing may be a problem later as well…

  • 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-27T11:59:28+00:00Added an answer on May 27, 2026 at 11:59 am

    First couple of things that come to mind:

    1. The registration point for the graphics for hsSlot1 is not exactly top-left.
    2. I can’t tell what scope you’re calling this code from, but if you’re calling it from a container that doesn’t contain hsSlot1 as a direct child then it may be within another container that is positioned slightly off.

    Why not try this (within the object hsSlot1 itself):

    Dispatch an event from hsSlot1 when the mouse is “over” it:

    if(mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height)
    {
        dispatchEvent(
            new Event("CUSTOM_ROLLOVER")
        );
    }
    

    And listen for it from elsewhere:

    hsSlot1.addEventListener("CUSTOM_ROLLOVER", _reaction);
    function _reaction(e:Event):void
    {
        trace('Glorious success.');
    }
    

    It still seems like you have graphics somewhere that aren’t justified top-left to the registration point. This dodgy diagram I just drew up might help you understand what I mean and why it would affect your code the way it does:

    enter image description here

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

Sidebar

Related Questions

Something really weird is going on with my database. I am using PHP to
I have encountered something weird (probably not, it's more likely that I don't really
Something really weird is going on. httpd.conf says apache runs as the apache user.
This is really weird and I fear I have just done something dumb but
I'm at my wits end, and it's probably something really simple. Basically I've have
Today I think i might have learned something (not sure), i'm not really a
Ok, I have just run into something that is really catching me off-guard. I
It doesn't really have to add newlines, just something readable. Anything better than this?
I have to be missing something simple, but I'm really not sure what. I
I am stuck with something quite simple but really annoying: I have an xml

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.