Back button

I have a back button on my website for a blog that basically just does subtraction for a variable in my move. That variable is passed on to a php page. The button can’t equal less than zero because I also have a next button and if I have -6 as the variable and I want to go to the next list of entries I hit next and it only changes the variable to 0 I have to hit the next button again. Here is the url for the example:

[url=]http://users.apex2000.net/rbrown/asp/flash_db/delete.html

and here is the code I’ve got on the back button, even though the variable goes to zero it still keeps all my backward clicks.

on (release) {
clicks–;
count = clicks*5+1;
countmath = count;
loadVariables(“demo.asp”, this, “POST”);
if (countmath < 0) {
countmath = 0
}
}

You should be trying to set the var ‘clicks’ to zero instead of ‘countmath’, like below:

**on (release) {
    clicks--;
    count = clicks*5+1;
    countmath = count;
    loadVariables("demo.asp", this, "POST");
    if ([color=red]countmath[/color] < 0) {
        [color=red]clicks[/color] = 0;
    }
}**

Instead you want the if statement to check if ‘countmath’ is lower than 0 and if it is then make ‘clicks’ equal to zero and if I am reading your script correctly the ‘clicks’ var is the main counter to total user clicks!

EDIT:*** I have looked at your code a little closer and then viewed your link and it looks as if you have the dynamic text field showing the value of ‘clicks’ and without setting that variable back to zero it will keep on counting down because the ‘countmath’ var is dependent on what the value of ‘clicks’ is! So, the updates code I gave you should work but again I could have a wrong assumption.***

But I may be wrong so reply back if that was not the correct solution! It would be easier to see all of the scripts used throughout your file visually to make a more educated solution but again thats the last resort.

Dan, you’re the king. That was exactly right. I don’t know why I didn’t look at it that way because it makes so much more sense. Clicks is the multiplier. Thanks a million. Another question I have though is, if you’ll notice now when I click on the back button a whole bunch of times there is still web activity.

What I mean is, say I click back 10 times then forward once. The movie try to go back 10 times before jumping forward. This causes a long pause and unneeded web traffic. Do you know a way I can cancel out the rest of the click action if there’s nothing to go back to? I was thinking maybe an else action. example: (note in actionscript)

if countmath < 0 then
clicks = 0
Else
clicks–;
count = clicks*5+1;
countmath = count;
loadVariables(“demo.asp”, this, “POST”);

sorry it’s not in as but i’m more familiar with asp, but i think its understandable. Do you think this could work?

Thanks again.

I’m not exactly sure what your talking about but does this help:

**on (release) {
    if (countmath < 0) {
        clicks = 0;
    } else {
    clicks--;
    count = clicks*5+1;
    countmath = count;
    loadVariables("demo.asp", this, "POST");
    }
}**

Thank you. That is exactly what I need. It works great.

To further explain the problem I was having, every time I clicked on the button to go back it would rerun the asp file I’m using. If I’m already at 0 there’s no reason to look back because nothing exists but the action script didn’t know that So what it would do is, for every time I clicked back it would reload the asp file, then when I clicked next it would have to wait until the other cycles of the asp file were done.

It’s kinda hard to describe, but I think you understand … thanks again.