Creat HitTestObject Actionscript 3.0
Diposting oleh
Unknown
on 11/04/15
Label: Flash tutorials
Okay, 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).
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).
0 komentar:
Posting Komentar