Sequential button availability

how do i set up the script so that the user has to click one button before another button will operate?

Something like this:


operate = false;
firstbutton.onRelease = function(){
operate = true;
}
secondbutton.onRelease = function(){
if(operate){
trace("You clicked the first button before pressing this one. Good boy !")
} else {
trace("Click the first button before clicking this one !");
}
}