A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: why is this hitTest not working

  1. #1
    Member
    Join Date
    Apr 2014
    Posts
    63

    why is this hitTest not working

    why is this hitTest not working:

    code:

    ar.onPress = function() {
    startDrag(ar);
    }
    ar.onRelease = function() {
    stopDrag();
    if (ar.hitTest(an)) {
    trace("d");
    }

    }


  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    It does work (tested), you possibly have something named incorrectly or inside of a clip!!

  3. #3
    Member
    Join Date
    Apr 2014
    Posts
    63
    i have a btn on my stage with an instance name of ar and then a MC on the same frame on stage with an instance name of an

    how is your stage set up?

  4. #4
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    I actually had 2 mc's on the stage, but anyway, with 1 button and 1 mc as like yours
    PHP Code:
    ar.onPress = function()
    {
        
    startDrag(this);
    };
    ar.onRelease = function()
    {
        
    stopDrag();
        if (
    an.hitTest(this))
        {
            
    trace("d");
        }
    }; 
    Last edited by fruitbeard; 04-23-2014 at 11:43 AM.

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