PDA

View Full Version : hitTest updating



maximum_flash
June 4th, 2004, 04:25 AM
after a deep search of the forums, i have been unable to find an answer to my question.

i am using this code as a way to perform a hit test on two objects.



isTouching=menu1.hitTest(ease);


initially, after i run a trace on this, it comes out false. what i am wanting to know is how i can continually update this so that when my ease clip glides into the other clip, it will recognize it and do something like this.



if (isTouching){
menu1.gotoAndPlay("start")
}


the problem is, my hit test seems to be static and does not update. anyone who could explain to me how to make it check this condition would be much appreciated. maybe something with setInterval?

sam

Johnny64
June 4th, 2004, 04:41 AM
onEnterFrame = function(){//frame loop
if (menu1.hitTest(ease)){// if checking the hit
menu1.gotoAndPlay("start")// doing some thing
}
}
:)

maximum_flash
June 4th, 2004, 04:45 AM
lol, man. just as soon as i figured it out i got on here to say nevermind and you had just posted. i appreciate the help though man!

ps-- thats exactly what i have now :)

sam

Johnny64
June 4th, 2004, 08:50 AM
welcome :thumb:

pom
June 4th, 2004, 10:30 AM
You should probably disable the check after the hit
this.onEnterFrame = function(){//frame loop
if (menu1.hitTest(ease)){// if checking the hit
menu1.gotoAndPlay("start")// doing some thing
delete this.onEnterFrame ;
}
} ;

maximum_flash
June 4th, 2004, 02:25 PM
ok, i got my hitTesting to work. now, i just want to make the code i have more generic to accomodate to 4 or 5 other clips.

i have this:


function isAttached(){
isAttached=menu1.hitTest(ease);
if (isAttached==true){
menu1.gotoAndPlay("start")
}
else if (isAttached!=true){
menu1.stop()
}
}
myTarget = setInterval(isAttached, 100);


i have this on a frame. what i want is to make this more generic to accomodate to hitTests for 4 other clips. any help would be appreciated.

sam