first of Key.isDown isn't part of AS3, if you want to use AS3 you need to use event listeners like this
stage.addEventListener(KeyboardEvent.KEY _DOWN , checkKeys);
stage.addEventListener(KeyboardEvent.KEY _UP, keyUps);
function keyUps(event:KeyboardEvent) {
if (event.keyCode == 39) {
event.keyCode = 0;
varRight=false;
trace("Right key is NOT down");
}
if (event.keyCode == 38) {
event.keyCode = 0;
varUp=false;
trace("Up key is NOT down");
}
function checkKeys(event:KeyboardEvent){
if (event.keyCode == 39) {
trace("Right key is down");
varRight = true;
}
if (event.keyCode == 38) {
trace("Up key is down");
varUp = true;
}
If you want to go with As2 then you can do this
this.onEnterFrame=function(){
myFunctionName();
}
function myFunctionName(){
if(Key.isDown(someKeycode)){
do this
}else{
do that
}
}