Simple code trick, maybe?

how do i nest this function in a way that it only does it once even if the timeline navigates to the frame with this code on it again:

this.gotoAndStop(getRandomLabel());

i tried to put it in a movie clip on a frame outside of the navigation so it never navigates to that frame again, but it still seems to be hitting the frame with this code.

hypothetically, i was hoping for something like:

doOnce.global = function () {
this.gotoAndStop(getRandomLabel());
}