So I am fairly new to AS3. I have an image moving round the screen so far using arrow keys and that works just fine.
The problem I have is registering the ‘p’ key hit. At the moment it is only registering when I use ‘shift’ along with ‘p’. But I want to be just able to press ‘p’ on its own.
Heres a snippet of my code:
function KeyUp(event:KeyboardEvent){
if(event.keyCode == 80){
key_p = false;
}
}
function KeyDown(event:KeyboardEvent){
if(event.keyCode == 80){
key_p = true;
}
}
This moves an image on the screen at a diagonal so I can visualy see if ‘p’ is being pressed.
if(key_p == true){
hero.x += 2;
hero.y += 2;
}
Thanks in advance.