Auto Incremented Button

I got a button working on an old application where everytime the button was pressed, a variable (i) was incremented by one, and then I used

on(release){
gotoAndStop(i);
}

but its not working anymore… Could I be doing anything stupidly wrong?