PDA

View Full Version : Key Codes



InsaneMonk
January 10th, 2004, 06:57 PM
I need help with key codes. this is what i got and it dont wrk:
onClipEvent(load) {
var key = Key.getCode();
}
onClipEvent(enterFrame) {
if (key == 68) {
trace("Problem Fixed");
}
}

senocular
January 10th, 2004, 07:00 PM
load only happens when the movieclip appears (or "loads") on the screen. It only would save the value of Key.getCode() to key at that one point in time and thats all. Not to mention that Flash 6 and lower is case insensitive so you'd be writing over the Key object using key (which you don't want to do). Just check for Key.getCode directly


onClipEvent(enterFrame) {
if (Key.getCode() == 68) {
trace("Problem Fixed");
}
}

InsaneMonk
January 10th, 2004, 07:04 PM
thanx sen. that worked.=) :P

Scootman
January 10th, 2004, 07:33 PM
or if you dont want it to interfere with enter frame stuff... onClipEvent(keyDown) would suffice yes?