How do I get my if statement to execute once, when its condition is met?

Hey all,

Im trying to create a little menu here. It has 8 options (with rollon animation, selected, rolloff animation), so I thought I would have a variable for each menu option.

So when menu option 1 is selected my variable (navvar) will = 1.

Here is my if statement / loop.

//for option1
if(_root.navvar == “1”){
_root.nav_main.home.gotoAndPlay(“onanimation”);
}

//options 2-8 like above else if(_root.navvar == “2”){ etc

Now my problem is that when the above is looping over its 2 frames, obvisouly it only plays a few frames of my “onanimation”, which means I get a flickering effect.

Could someone show me how I can setup this code so that when navvar = 1 I can simply go and play my “onanimation” once only, (until another variable is selected etc)

Any help is much appreciated.