I don't really understand what you want, but I can try to help anyway. If you want to make an object move with the arrow keys, just use code snippets (with Flash CS5) and change the variable names and you might fool your teacher. The real answer is this:
This is the code (Actionscript 3.0): wrote:
import flash.events.KeyboardEvent;
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
function keyPressed(evt:KeyboardEvent):void
{
switch(evt.keyCode)
{
case Keyboard.UP :
//Your code goes here
/*Example:*/trace("You pressed the UP key")
break;//the break; is very important
case Keyboard.RIGHT :
//Your code goes here
/*Example:*/trace("You pressed the RIGHT arrow key")
break;//the break; is very important
case Keyboard.DOWN :
//Your code goes here
/*Example:*/trace("You pressed the DOWN arrow key")
break;//the break; is very important
case Keyboard.LEFT/going clockwise
//Your code goes here
/*Example*/trace("You pressed the LEFT arrow key")
break;//the break; is very important
}
}
If you have access to Code Hinting you don't have to write the import flash.events.KeyboardEvents part. Hope this helps you cheat on your homework!
Offline
I suggest always putting your scripts on a blank layer, and Keyboard events work best on the stage. Check out http://www.lynda.com/ for some Actionscript tutorials.
Offline
Dude, that is AS3, learn key presses from flash game source man.
Really just learn everything on the flashgame source tutorial for AS2 and you can make some games already, take like a week if you have no idea about anything.
Offline