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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Maybe someone can help me figure th

Status
Not open for further replies.

janeekg

Programmer
Jun 13, 2002
4
US
Maybe someone can help me figure this out...

Below is my code. It is a movie to detect keypresses. Basically what it is intended to do is the following:
-if a person presses Ctrl/C (nested below), Q1=correct.
-If a person presses anything but that combo, Q1 is incorrect.

This means I have to check first for any key press other than ctrl, and mark that as incorrect.

The tricky part is then tracking if the person does hit ctrl, I have to make sure that everything but ctrl followed by c is incorrect (ei, ctrl/a, ctrl/b, ctrl/d are all incorrect - only ctrl/c is correct).

Any ideas on how to do this? Seems like when I nest the two key downs and add and else statement, the second keydown is ignored. Below is my script:

onClipEvent (keyDown) {
pressed = Key.getCode();
if (Key.isDown(17)) {
if (Key.isDown(88)) {
_root.Q1 = "true";
_root.NextFrame();
}
}
}

Thanks!

 
What you need is :

Code:
onClipEvent (keyDown) {
    pressed = Key.getCode();
    if (Key.isDown(17) && Key.isDown(88)) {
        _root.Q1 = "true";
        _root.NextFrame();
    }
}
Regards

David Byng

spider.gif


davidbyng@hotmail.com
 
hello I wanted to put flash animation on my page as a intro..and thing i WANNA DO IS THIS LOADING THING ON THE BEGINING LIKE IT WILL LOAD FIRST THEN MOVIE WILL BE ABLE TO PLAY...HOW TO DO THAT ..HEEELPPP:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top