Skip navigation
Currently Being Moderated

Problem with hitTest and gotoAndStop()

Apr 12, 2013 11:09 AM

Tags: #help #flash #actionscript #actions #cs6 #flash_cs6

I am working on a small game and I want to write a code so when my human character hits a meteor you go to frame 4 in the timeline.


I have written this code in the human actions:



if ( this.hitTest(_root.meteor1) ) {






When trying it shows no errors but it does not work.


Any help is appreciated here.


Thanks :-)

  • Currently Being Moderated
    Apr 12, 2013 11:12 AM   in reply to EnigmaWarrior

    You need to constantly be checking for the hit.  If you do not have that code constantly cycling then you need to make it so.


    YOu can try using an enterFrame function for it...


    this.onEnterFrame = function(){

        if ( this.hitTest(_root.meteor1) ) {

            delete this.onEnterFrame;




    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