Basic of HitTestObject Actionscript 3.0

Hello blogger,  this time on the basis of using hitTest Object. HitTestObject script is a script to detect the collision of an incident in which two objects touch each other. For more details see the following script:
1. Make two objects with a movie clip instance name "mc_box" and "mc_oval".
2. Later in the frame 1 press F9 to activate the actionscript window.
3. Then type the following script:
addEventListener (Event.ENTER_FRAME, collision);
function collision (event: Event): void {
     if (mc_box.hitTestObject (mc_oval)) {
           trace ("ouchh"); // <- Displays the message "ouchh"}
     }
}
4. Run the program (Ctrl + Enter).

Share this

Related Posts

:)
:(
hihi
:-)
:D
=D
:-d
;(
;-(
@-)
:P
:o
:>)
(o)
:p
:-?
(p)
:-s
(m)
8-)
:-t
:-b
b-(
:-#
=p~
$-)
(y)
(f)
x-)
(k)
(h)
cheer