There are many many ways you could go about this depending what feels right to you and other technical needs. But lets take a very simple albeit not rock solid approach.
Typically this kind of thing is done with arrays (which are just lists of things) where each button press would add an item to the list and then the whole list would be checked one item at a time to see if it's in the right order.

You can however get similar control by comparing strings. Basically you'll have your correct answer string, say "1234" and you'll have the students string which will be what ever order they clicked in so something like "1423". So each on each button click you'll compare the two to see if they match (answer == student ?). The thing to keep in mind is that upon the first click you'll only have one number, two on the second click and so on. So in addition to checking if the values match, you'll to need to check if the number of numbers match. Since they're strings you're comparing the number of characters (they're not actually numbers at this point). This is known as a String's length.

So if the lengths are the same and they match, you can move to the next frame, if the lengths are the same and the don't match, you'll have to respond differently.

Here's what it might look like (I'm assuming you're using AS3):
Code:
//here we define the two value strings
var answer:String = "1234";
var student:String = ""; // we give it an empty string as a default value because without a value at all you'd get an error saying it was null

// this is the function each button's event handler will call
// we're going to assign each button their own unique "id" which we'll check here to find out who was clicked
function onWordClick(event:Event):void{
  var id:String = event.target.id;
  student += id;
  if(student.length == answer.length){
    // check the values, otherwise skip this part
    if(student == answer){
      // correct!
    }else{
      // incorrect
    }
  }
}

// now assign each button their unique id and a click handler
btn1.id = "1";
btn1.addEventListener(MouseEvent.CLICK, onWordClick);

btn2.id = "2";
btn2.addEventListener(MouseEvent.CLICK, onWordClick);

btn3.id = "3";
btn3.addEventListener(MouseEvent.CLICK, onWordClick);

btn4.id = "4";
btn4.addEventListener(MouseEvent.CLICK, onWordClick);