# Problem with play x frames, then gotoAndPlay

**URL:** https://forum.kirupa.com/t/problem-with-play-x-frames-then-gotoandplay/279335
**Category:** Uncategorized
**Created:** [January 13, 2009, 4:48pm UTC](https://forum.kirupa.com/t/problem-with-play-x-frames-then-gotoandplay/279335 "2009-01-13T16:48:08Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![croix](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/croix/32/3421_2.png) [@croix](https://forum.kirupa.com/u/croix)
#### Post date: [January 13, 2009, 4:48pm UTC](https://forum.kirupa.com/t/problem-with-play-x-frames-then-gotoandplay/279335/1 "2009-01-13T16:48:08Z")

</div>

I recently upgraded to CS3 and AS3, and this is the first site i have built in flash since the upgrade.

Im not a big actionscript guy, and now im running into problems.

I have a site, and every page for the site is layed out in the main timeline.

my preloader (AS3) loads, then the first page plays until stop.

What I want to happen is when a user clicks a button, I want to play the next 15 frames, then gotoAndPlay the first frame for whichever button was clicked.

in AS2, i would do something like:

```auto
but_home.onPress = function () {
	advanceFrames();
}
function advanceFrames () {
	var frameNum:Number = 0;
	onEnterFrame = function () {
		if (frameNum <= 15) {
			nextFrame();
			frameNum++
		}
		else {
			delete this.onEnterFrame;
			gotoAndPlay(48);
		}
	}
}

```

but this gets me nowhere in AS3. If I change my publish settings to AS2, this seems closer to working (though its still not working right) but my preloader wont work.

where am I going wrong?
