0
on(keypress ...)... how to use keycode?
LEGEND
,
/t5/animate-discussions/on-keypress-how-to-use-keycode/td-p/844375
Dec 15, 2008
Dec 15, 2008
Copy link to clipboard
Copied
Hi all,
I need to update an old application where I can to control some objects at
runtime.
The old application used the
on(keypress "<right>") {
bla;
bla;
bla;
}
to move the selected object to the right.
All went ok this way.
But now I need to use the numpad keys to move the object along diagonals,
up, down, right and left.
Is there a way to use the keypress command and specify a character code for
the numpad keys?
I've read the livedocs on adobe websites but it seems I need to rewrite the
whole thing.
Is there a simpler way to update this application without rewriting it from
the ground up?
TIA
tony
I need to update an old application where I can to control some objects at
runtime.
The old application used the
on(keypress "<right>") {
bla;
bla;
bla;
}
to move the selected object to the right.
All went ok this way.
But now I need to use the numpad keys to move the object along diagonals,
up, down, right and left.
Is there a way to use the keypress command and specify a character code for
the numpad keys?
I've read the livedocs on adobe websites but it seems I need to rewrite the
whole thing.
Is there a simpler way to update this application without rewriting it from
the ground up?
TIA
tony
TOPICS
ActionScript
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Explorer
,
/t5/animate-discussions/on-keypress-how-to-use-keycode/m-p/844376#M242581
Dec 15, 2008
Dec 15, 2008
Copy link to clipboard
Copied
You should be able to use the ASCII key codes to control your
object. If not im sure you can build a listener that can listen for
the ASCII codes you are after and run each function as it recieves
them, I could be wrong but hope this helps
Damien
Damien
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Newsgroup_User
AUTHOR
LEGEND
,
/t5/animate-discussions/on-keypress-how-to-use-keycode/m-p/844377#M242582
Dec 16, 2008
Dec 16, 2008
Copy link to clipboard
Copied
> You should be able to use the ASCII key codes to control
your object.[snip]
> Damien
Thx, Damien,
do you know the right syntax to use with "keypress"; I tried everything:
on(keypress 102){
bla...;
bla...;
bla...;
}
or
on(keypress "102"){
bla...;
bla...;
bla...;
}
or
on(keypress charcode(102)){
bla...;
bla...;
bla...;
}
...
...but nothing worked...
Ciao ;).
tony
> Damien
Thx, Damien,
do you know the right syntax to use with "keypress"; I tried everything:
on(keypress 102){
bla...;
bla...;
bla...;
}
or
on(keypress "102"){
bla...;
bla...;
bla...;
}
or
on(keypress charcode(102)){
bla...;
bla...;
bla...;
}
...
...but nothing worked...
Ciao ;).
tony
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Explorer
,
LATEST
/t5/animate-discussions/on-keypress-how-to-use-keycode/m-p/844378#M242583
Dec 16, 2008
Dec 16, 2008
Copy link to clipboard
Copied
I think this is what your after.
http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Part...
In this code, they are creating a listener to listen for the keydown event in which they run that function that gets the key codes and/or ASCII codes. From this you could create if statements to control your object based on the keycodes your code "gets".
You may have to do a little bit of fiddling with your sequence of functions but shouldnt be 2 hard.
Hope this helps you.
Damien
http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Part...
In this code, they are creating a listener to listen for the keydown event in which they run that function that gets the key codes and/or ASCII codes. From this you could create if statements to control your object based on the keycodes your code "gets".
You may have to do a little bit of fiddling with your sequence of functions but shouldnt be 2 hard.
Hope this helps you.
Damien
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

