dcsimg
A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Check for button over state?

  1. #1
    Junior Member
    Join Date
    Jul 2005
    Posts
    10

    Check for button over state?

    Hi there,

    I'm almost finished one of my first projects in Flash - a menu for a website. I have animated cursors alongside my menu items, and have been struggling with the issue of the mouse pointer leaving the movie area, and this change not being registered (_xmouse and _ymouse remain at their last recorded positions). The effect of this is that my cursor-return animations do not play at times when the pointer leaves the stage quickly.

    I noticed that the button rollOut is never missed, no matter the speed the mouse is moved, so I planned to have the condition for the cursor-return anitmaions as: no mouse overs on any of the buttons, as opposed to my current condition based on mouse pointer location.

    So my question! (Finally, sorry.) Is there a way to check if the button is in the 'over' state, like a get method, returning a boolean?

    Thanks in advance to anyone who has advice on this. =)

  2. #2
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,490
    Try using an updateAfterEvent line in the code.

  3. #3
    Junior Member
    Join Date
    Jul 2005
    Posts
    10
    Ok, thank you for the reply.

    I understand that updateAfterEvent will refresh the frame when called within an onClipEvent handler. Do you mean, I'd use that to update the mouse pointer's location whenever a rollOut occurs? If so, where could I put the updateAfterEvent? I checked the ActionScript Dictionary, and it doesn't seem like rollOut can be a parameter that onClipEvent takes. Maybe I have the wrong end of the stick...

  4. #4
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,490
    Here's an example. I don't know what code your using;

    circle.onMouseMove = function(){
    this._x = _root._xmouse;
    this._y = _root._ymouse;
    updateAfterEvent();
    };

  5. #5
    Junior Member
    Join Date
    Jul 2005
    Posts
    10
    Well, my code is of the form:

    stop();
    cursor_mc.onEnterFrame = function() { };

    And I think I see what you're getting at, but do you know of the problem I mentioned above? _root._ymouse and _root._xmouse report the last place the pointer was before it left the movie. I've read about some of the similar difficulties others have had here and in similar threads. For that reason, I don't think updateAfterEvent(); will make a difference. I was really wanting to know whether it was possible to poll the status of a button, as buttons aren't susceptable to the problem.
    Edit: typo
    Last edited by brandylad; 08-02-2005 at 01:42 PM.

  6. #6
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,490
    I don't of any way to tell the status of a buttom symbol, unless you set a variable on one of the events. I know you can't target anything inside a button symbol with script.

  7. #7
    Junior Member
    Join Date
    Jul 2005
    Posts
    10
    Ok, thank you - I'll try that. =)

    I'll inform about how I get on.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center