A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: I dont get hitTest...

  1. #1
    Senior Member
    Join Date
    Oct 2005
    Posts
    157

    I dont get hitTest...

    Hi,

    i have this actionscript and i dont know where to put it to ake it work:

    if(obj1.hitTest(obj2)){
    gotoAndPlay(frame number or frameLabel)
    }

    Yeah... where do i put it? on obj1? obj2? the frame on timeline? and also...

    what do i do? make another scene and make it play that? and put stop() on the end of the first scene?

    please respond =D
    Imagination is the creator of reality...

  2. #2
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    Movement and simple hittest

    http://www.actionscript.org/resource...est/Page1.html

    hope this tute helps
    if not, Google flash hittest tutorial

  3. #3
    Senior Member
    Join Date
    Oct 2005
    Posts
    157
    but i want to know what i can do with THIS actionscript instead:

    if(obj1.hitTest(obj2)){
    gotoAndPlay(frame number or frameLabel)
    }


    someone please reply,
    Thanks =)
    Imagination is the creator of reality...

  4. #4
    Junior Member
    Join Date
    Dec 2006
    Posts
    17
    Quote Originally Posted by FlashmanSK
    but i want to know what i can do with THIS actionscript instead:



    someone please reply,
    Thanks =)
    Put this code in the frame Actions

    Also, if you want to put it into another mc you will have to do this:

    if(_root.obj1.hitTest(_root.obj2)){
    gotoAndPlay(frame number or frameLabel)
    //do something as well if you want
    }

    By the way, this one is 100% safe
    Last edited by Mr.Qwerty; 12-09-2006 at 05:11 PM.

    Mr.Qwerty

  5. #5
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    offer him a net and all he wants is a fish
    sheeesh !!

  6. #6
    Senior Member
    Join Date
    Oct 2005
    Posts
    157
    [QUOTE=Mr.Qwerty]Put this code in the frame Actions

    what u mean my the Frame Actions, and also, how should my timeline and complete layout be for this to work?

    sorry to bother u with all these newbie questions


    thanks
    Last edited by FlashmanSK; 12-18-2006 at 03:47 PM.
    Imagination is the creator of reality...

  7. #7
    Senior Member
    Join Date
    Apr 2006
    Posts
    1,059
    one possibility would be select the first frame
    open actions panel
    type
    _root.onEnterFrame = function(){
    if(_root.myMC1.hitTest(_root.myMC2)){
    trace("hit!!!")
    }
    }

  8. #8
    Senior Member
    Join Date
    Oct 2005
    Posts
    157
    awesome it works but just one thing...

    i wanted it to be like a gotoAndplay thing

    sorry, but that is awesome
    Imagination is the creator of reality...

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