This is a code that I have on a movie clip:
onClipEvent(enterFrame){
if (Key.isDown(Key.SPACE)){
_root.acc = 2;
}else{
_root.acc = 10;
}
}
How do I make on key A - so you can press A instead of Space?
This is a code that I have on a movie clip:
onClipEvent(enterFrame){
if (Key.isDown(Key.SPACE)){
_root.acc = 2;
}else{
_root.acc = 10;
}
}
How do I make on key A - so you can press A instead of Space?
onClipEvent (enterFrame) {
if (Key.isDown("A".charCodeAt(0))) {
_root.acc = 2;
} else {
_root.acc = 10;
}
}
What does charCodeAt(0) 0 the 0 stand for?
It means the 0th (or first) character in the string “A” (which is A).
For example:
“ABC”.charCodeAt(1) would provide the code for “B”.
You could also just use 65 (the ascii value of of upper-case A).
:: Copyright KIRUPA 2024 //--