Skip navigation
Currently Being Moderated

Pop Up + Hit Test

Jul 9, 2012 4:08 AM

hello.

 

 

i am creating a game and i want that whenever my man touches the door, the second game will be open as pop up.

 

 

I m confused how to do this??

 

Can anyone help me?

 
Replies
  • Currently Being Moderated
    Jul 9, 2012 4:42 AM   in reply to sachin_mak

    Which aspect of this are you confused about?  Show and explain the code you have tried.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 10, 2012 6:50 AM   in reply to sachin_mak

    The hitTest needs to be constantly checked.  The way you have it, it only checks once when the code is first read.  If they are not touching when the file starts, then the hitTest will not trigger.  Try adding something like the following for that hitTest...

     

    ply2r.addEventListener(Event.ENTER_FRAME, checkForHit);

     

    function checkForHit(evt:Event):void {

        if(plyr2.hitTestObject(btn1))

        {

              ply2r.removeEventListener(Event.ENTER_FRAME, checkForHit);

              ShowPopUp();

        }

    }

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 12, 2012 4:56 AM   in reply to sachin_mak

    Use the trace command in your HidePopUp function to see if that function is being called at all.  If not, the button might be getting blocked by some other listener or object.  If the function is called, then you want to trace the e.currentTarget.parent to see if it is what you expect it to be.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points