Help with next/previous code!

Im trying to make a slide show with a next and previous button. I have name these two buttons next_button and previous_button

I 've tried the code ;

next_button.onRelease = goNext;
previous_button.onRelease = goPrev;

function goNext():Void{
gotoAndPlay(_currentframe+1);
}
function goPrev():Void{
gotoAndPlay(_currentframe-1);
}

however , it isn’t working , can anyone help?! plzzzzzzzzzzzzz

and how should i apply the code ?! maybe my method was wrong

Many thanks