Simple If/then help

I’m trying to write an if then statement that will loop back to frame 1 once the next frame it hits is higher than 5. For some reason it doesn’t work and I could easily go to frame six and add a go to and play but, I’d like to learn what’s wrong instead of doing it the easy way. :slight_smile:

on (release) {
if (_root.player_currentframe > 5) {
gotoAndPlay(1);
} else {
_root.player.nextFrame();
}
}

Mer

Replace your code for this one: [AS]on (release) {
if (_root.player._currentframe>5) {
_root.player.gotoAndPlay(1);
} else {
_root.player.nextFrame();
}
}[/AS]
[edit]I assumed you wanted your player movie clip to go back to freame 1. And you missed a dot before _currentframe.[/edit]

hmm that didn’t work it just sits there when it get’s to frame 5… wich is the same problem I was having.

Post the fla :slight_smile:

Here ya go. The actions are on the mp3 player buttons, and they are controlling the main timeline in the player movieclip.

Hope that makes sence.

on (release) {
	var frame = _root.player._currentframe;
	_root.player.gotoAndStop(frame>=5 ? 1 : frame+1);
}

Of course it wont work. Your player movie clip has exactly 5 frames, so the statement if currentframe>5 will never be true.
Change for this:[AS]on (release) {
if (_root.player._currentframe==5) {
_root.player.gotoAndPlay(1);
} else {
_root.player.nextFrame();
}
}
[/AS]

Kax was faster :stuck_out_tongue:

too late buddy. :stuck_out_tongue:

Sheesh, I swear I did it the way you posted the code the 2nd time and it didn’t work… :frowning:

Thanks for your help guys. :slight_smile:

:wink:

You’re welcome :slight_smile:

Dam n Kax is a fast typer!
:stuck_out_tongue:

:stuck_out_tongue:

nah… i’m just bored. :-\

Since your both reading this thread and the file is posted. Either of you feel like taking a look at how I might go about getting my counter working to show the duration of the song?