A "gotoAndPlay() question

Can’t I use gotoAndPlay() with a variable?
Ex:
framenum = 15 ;
.
.
.
gotoAndPlay(framenum);

does this work?

I tried but someway it doesn’t work… Is there a way that I can use gotoandplay like this?

thanks for replies

Yes it works.

Make sure you target your variable correctly (if the variable exists on a different timeline from where you are calling it from).