How can I stop picture from blinking after double-clicking gallery arrow?

I have an XML gallery (designed by Scotty!) that has a problem. If you double-click (or quickly click) on the forward or backward arrow to cycle through each picture, the picture starts to blink and the gallery can’t be used anymore. :frowning:

Is there a way that can be mentioned in the code that the arrow can only be clicked once and then becomes disabled until after the pic loads?

This is the code right now for the forward and backward buttons:

function setPortfolioNr(t) {
	back_btn.onRelease = function() {
		index>0 ? index-- : index=t-1;
		choosePortfolio(index);
	};
	fwd_btn.onRelease = function() {
		index<t-1 ? index++ : index=0;
		choosePortfolio(index);
	};
}

If there is something else that I’m missing, I’ll attach the gallery to this post! Thanks!!