Stop script

i’m trying to figure out how to create a script that will perform a stop(); after the frame has been hit 3 times

so i think i need to set a variable and add 1 to it each time the frame is hit until it gets to 3 and then when it hits 3 stop();

so would it look like this?


i=0
onEnterFrame{
if (i>=3){
stop();
}else{
i+=1;
}
}