i thought we were spamming the Inkman thread enough at it is...well to be to the point, im learning AS3 cuz my computers messing with me and wont load AS2 documents, im tryin' to create a game engine (whoop de doo) and decided to start with getting keys down (since AS3 dosnt recognize the keyDown function, we have to use advanced boolean crap and import classes and stuff!) heres my key detection code:
import flash.events.Event;
import flash.events.KeyboardEvent;
var rightMove:Boolean = false;
var leftMove:Boolean = false;
var xspeed:Number = 5;
var yspeed:Number = 5;
stage.addEventListener(KeyboardEvent.KEY_DOWN, checkKeys);
function checkKeys(event:KeyboardEvent):void
{
if (event.keyCode == 37)
{
trace("key LEFT is DOWN"
;
leftMove = true;
}
if (event.keyCode == 39)
{
trace("key RIGHT is DOWN"
;
rightMove = true;
}
}
stage.addEventListener(KeyboardEvent.KEY_UP, keyUps);
function keyUps(event:KeyboardEvent):void
{
if (event.keyCode == 37)
{
trace("key LEFT is UP"
;
leftMove = false;
}
if (event.keyCode == 39)
{
trace("key RIGHT is UP"
;
rightMove = false;
}
}
stage.addEventListener(Event.ENTER_FRAME, Movement);
function Movement(event):void
{
if (leftMove == true)
{
player.x -= xspeed;
}
if (rightMove == true)
{
player.x += xspeed;
}
}
VideoGuy has his own method, which is probably better, but this is the LAZY mans method! now im gonna start working on incorporating friction, then ill add ground gravity etc. anyone wanna use this as an AS3 thread, feel free to. oh, a AS3 is too hard!

