|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
responding to keys
I'm using the following function to move sprites. The if with key.isDown(key.LEFT)) works properly. The other IFs have variables that represent the numberical ascii values of the keys. For instance _root.rbutton is the number 97 which is the letter a. However, those ifs are not working. How do I detect for keys that do not have constants associated with them such as the letter a b d m x y z?
function moveMouse() { if (Key.isDown(key.LEFT)) { this._x -= 5; } if (Key.isDown(_root.rbutton)) { this._x += 5; } if (Key.isDown(_root.ubutton)) { this._y -= 5; } if (Key.isDown(_root.dbutton)) { this._y += 5; } trace("calling moveMouse"); }
__________________
Some day I'll create a smart quote to put here. |
|
#2
|
|||
|
|||
|
this worked OK for me
Code:
ubutton = 65;//a
dbutton = 66;//b
rbutton = 67;//c
function moveMouse() {
if (Key.isDown(_root.rbutton)) {
this._x += 5;
} else if (Key.isDown(_root.ubutton)) {
this._y -= 5;
} else if (Key.isDown(_root.dbutton)) {
this._y += 5;
}
trace("calling moveMouse");
}
my_mc.onMouseMove = moveMouse;
|
![]() |
| Viewing: Dev Shed Forums > Web Design > Flash Help > responding to keys |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|