Friday, May 15, 2015

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).
Location: Amerika Serikat

0 comments:

Post a Comment

Popular Posts

Categories

tutorial-nia. Powered by Blogger.