Simple high-score question

Post #1 by Creampie is hidden because that user is banned. show

Creampie said

a long time ago | Post #1
Ok, check it out.. I'm new at actionscript, so bare with me..

Basic layout of my Flash:

Frame 1: Title Screen
Frame 2: Game
Frame 3: Ending screen with score


On Frame 3, I have the following code. I'm sure theres a far better way of doing this, but basically I have it set so when the Flash reaches frame 3, it executes the NonobaAPI code and sends the high score.

_root.createEmptyMovieClip("watcher", _root.getNextHighestDepth());
_root.watcher.onEnterFrame = function() {
if (currentFrame == 3) {
NonobaAPI.SubmitScore("myscore1", score, highscore_callback);
_root.watcher.removeMovieClip();
}
}


Frame 2 has this code (I'm attempting to reset the score..):
score=0;



The Problem:
When I play the game the 1st time, it works and submits the score.
When I press the 'Play Again' button (which just sends you back to Frame 2 to play again), it works fine on the 2nd time and submits the score.
The 3rd time I try and play it though, it won't submit the score. I have to refresh the page and play again in order to submit any scores.

How can I truly reset the game score when moving back to another frame?


Thanks :)

404404 said

a long time ago | Post #2
I'm not sure from your description what your problem might actually be. It sounds like most everything should work...

I would, however, not use the createMovie/removeMovie code you're using for the submit score function.

Just take the line
NonobaAPI.SubmitScore("myscore1", score, highscore_callback);
and put it on the third frame outside of an enterFrame, like you would when declaring a variable.

That may or may not actually solve your problem, it's hard to say.

Reply to thread

Sign up now to reply to threads

Funkyball

funkyball.com is an independent gaming site where you can play both single- and multiplayer games for free.

Developer Tools

If you're a flash game developer, we've got some awesome tools to help you make even better games.

Great Games

Why not try some of the very best online flash games we've got, completely free?

Copyright ©2007-2012 Funkyball™ - All rights reserved.39.0022ms on SERVER34097