Recording keypresses, keeping score

Hi all,

First off, I’ll say that I realize that these are very basic questions that I have, and that there are probably tutorials out there that explain exactly how to do this. I have looked, though, and tried the Flash help file, but have had no luck working things out.

Alright, so… here’s what I need to do (in as clear an explanation as I can give):

I need to design a basic experimental “game” for a research class. The subject is simply shown two images, and needs to decide if the two images were the same or different by pressing one of two keys (let’s say “S” for same and “K” for different). The game needs to keep track of their input/accuracy. There are four different types of images that will be shown, though, and they’re shown in random order (say 1-3-4-4-2-3-1-2…). The game needs to keep track of their accuracy for each type of image comparison separately. At the end of the game, the program should be able to show the results on screen (i.e. subject said “same”, image was different… accuracy for image type 1 was 75%, etc.)

That’s not too bad, right?

So I have the images showing up, for the time I want, without a problem. To make things easier, I’ve decided that I can rearrange the frames manually to create a random order, rather than trying to program the game to do this. Great. And that’s where I am at this point. I can’t get Flash to detect the “S” or “K” input, and I can’t get it to keep a tally of the subject’s correct answers. Obviously I’m not this far ahead yet, but I also don’t know how I’ll get the game to display the results at the end by tallying up the subject’s input.

… and this is what I’m working on doing. Just to summarize, here are the things that I don’t know how to do, but wish I did:

[LIST=1]
[]Get Flash to detect keyboard input. (I’ve found lots of tutorials about how to use the arrow keys to drive a car, move a bug, etc… but that’s not what I need). Flash just needs to be able to tell if the subject pressed “S” or “K”.
[
]Get Flash to keep a tally of correct answers for each condition. I image this will involve using some sort of variable, and simply adding +1 for each correct answer. I also imagine that I’d use four variables, one for each condition?
[*]Get Flash to call up the results of the game at the end. I’m guessing this would just involve displaying the current state of the four variables at the end, which should be easy (?).[/LIST]I am NOT concerned about having to do a lot of things manually - if it doesn’t HAVE to be automated, I won’t bother trying to do it. For example, I mentioned I don’t want to bother attempting to program random order. I also don’t mind if I have to manually alter each input screen to know what each input would mean (i.e. I program the button after one trial to know that image type 3 was just presented, and the images were the same, so if the subject presses “S” add +1 to variable 3 and move on, otherwise just move on to the next image pair).

Rereading over this, I may have failed at making this clear. But if anyone has ANY advice, even if it’s only for one part of my problem, I’d appreciate it. Links to tutorials would also be appreciated.

Cheers, thanks for your help!