create a global variable for the button
In the set up function
creat the button
hide it
add an event listener to run a specific function for the button
var confirmBut;
function setup(){
confirmBut = createButton('Confirm');
confirmBut.hide();
//function for mouse listener
confirmBut.mousePressed(function () {
checkAnswer(phraseNumber); //when button pressed run the function checkAnswer
});
}