Click on Stage and using the keyboard arrows bring the disc to the base, and both will disappear !
CLICK HERE TO SEE A LIVE DEMONSTRATION OF THIS TUTORIAL COMPLETED
On this Actionscript 3.0 Flash HD High Definition Tutorial we create a base for our Flying Saucer and testing collision with an IF statement a visible property change is fired. X Files Theme is the background music.
DOWNLOAD THIS TUTORIAL TO YOUR HARD DRIVE
CLICK HERE FOR A COMPLETE ACTIONSCRIPT 3.0 CARTOON SMART TUTORIAL
Here is the source code
// Collision Between Two Objects on Stage Example
// by Avraham Saltoun
// solutions at say-web dot com
// FREE TO USE COPY AND DISTRIBUTE
stage.addEventListener(KeyboardEvent.KEY_DOWN,MoveSaucer);
//This will set the compiler
//waiting for a key stroke, and then
// execute the MoveSaucer function
function MoveSaucer (event:KeyboardEvent):void
// the void states that the function returns no value
// but receives the value of the key stroke
{
switch (event.keyCode){
case Keyboard.RIGHT:
FlyingSaucer_mc.x = FlyingSaucer_mc.x+5;
break;
// x is the coordinate for the horizontal position
// break will exit the switch and wait for
// next key stroke.
case Keyboard.LEFT:
FlyingSaucer_mc.x -=5;
// “FlyingSaucer_mc.x = FlyingSaucer_mc.x-5″
// is the same as
// “FlyingSaucer_mc.x -=5;”
break;
case Keyboard.UP:
FlyingSaucer_mc.y -=5;
break;
case Keyboard.DOWN:
FlyingSaucer_mc.y +=5;
break;
}
// This will check the collision
// between the Flying Saucer and
// the base.
if (FlyingSaucer_mc.hitTestObject(Base_mc))
{trace (“BOOOM !!!”);}
// Note both objects can be in separate layers
// instance names have to be identical to the objects
// This will happen every keystroke (Key Down) event
// Thanks for watching.
}



































October 5th, 2009 at 3:58 pm
Realmente é muito bom. Parabens. BRASIL Olimpiadas 2016.
October 5th, 2009 at 4:20 pm
muito obrigado, faca a assinatura, que eh gratis, e visite sempre que possa, aumentando nosso transito. Avraham Saltoun.
October 27th, 2009 at 2:58 am
great,it is good tutorial for beginner
November 14th, 2009 at 11:27 pm
Hey,
How can I get to lesson 1,2,3 etc.?
Thanks in advance.
November 14th, 2009 at 11:35 pm
here:
http://say-web.com/?page_id=3457