Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP: key.getascii with a variable 1

Status
Not open for further replies.

CarddassX

Programmer
Apr 2, 2002
9
US
I have a movie clip instance on my stage and I want to place coding on it that'll allow the user to press any key on the keyboard so that they can proceed on to the next frame. The way I'm trying to do it is to set up a variable for the getascii function and limit that variable to a number between 0 and 255.
--------------------------------------------
onClipEvent (keyDown) {
set ("x", "y");
y>=0;
y<=255;
if (Key.getAscii() == &quot;x&quot;) {
gotoAndPlay (2);
}
}
--------------------------------------------

Any suggestions?
Thanks in advance!

-Cardy
 
onClipEvent (keyDown) {
trace (Key.getAscii());
if (Key.getAscii() >=0 && Key.getAscii() <=255) {
_root.gotoAndStop (2);
}
}

Might not work for some key presses, for which the code is higher than 255.
The trace action I added above will print out the Ascii for key pressed in the Output window, when you test it!

Regards,
And might I be blessed with your vote!
new.gif
 
Thanks oldnewbie,
you don't know how many hours I was trying to figure that out. I need to learn the syntax and all that jazz so that I won't have to worry so much about it when I program. You wouldn't happen to have any recommendations on a flash actionscripting book, would you?
And I gave you a vote for your post, I didn't know what the deal was with that. I went back and gave you a star for the other dilemna you helped me out with.

Thanks,
-Cardy
 
It was a pleasure helping you out!
You, at least, have manners!

For Actionscript books... The word is that ActionScript the definitive guide by Colin Moock is favored by most!

If you're thinking Flash Mx, you might wait just a bit to see if Colin will update his book.

Otherwise you can check these:


Regards,
new.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top