Press and hover detection
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Press and hover detection

  1. #1
    Junior Member
    Join Date
    Jan 2014
    Posts
    12

    Press and hover detection

    I want to detect when the mouse is pressed & held and hovered over a certain movieclip, let's call it "a"

    How can I detect this action ?

  2. #2
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    949
    import flash.events.MouseEvent;

    var hold:Boolean;

    stage.addEventListener(MouseEvent.MOUSE_MOVE, Controls);
    stage.addEventListener(MouseEvent.MOUSE_DOWN, Controls);
    stage.addEventListener(MouseEvent.MOUSE_UP, Controls);
    function Controls(e:MouseEvent):void
    {
    switch(e.type)
    {
    case "mouseMove":
    if(hold == true)
    {
    trace("hold = true");
    if(a.hitTestPoint(mouseX, mouseY))
    {
    trace('is touching "a"');
    }
    }
    break;

    case "mouseDown":
    hold = true;
    break;

    case "mouseUp":
    hold = false;
    break;
    }
    }
    Hi Object, Listen, i wish to return you something, but only if what you are saying is true, else, forget it, ROLL_OVER the floor, i will check for someone else at the stage, while eating a no.visible cookie.

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

Poll by Flashkit.com