Originally Posted by adiboy
After 2 tries, a popup will be shown saying "Incorrect, the correct answer is 20."
|
hmm I don't remember my Flash ActionScripting too well (I last used it more than a year ago) but I rewrote yours, hopefully it works:
Code:
on (release)
{
clickcounter++;
if(clickcounter >= 2)
{
//User would only end up here if he's used up his two chances so add the popup here
clickcounter = valueNum = 0;
}
else
{
switch(valueNum)
{
case 20:
nextFrame();
clickcounter = valueNum = 0;
break;
default:
//User would only end up here if he guessed the wrong answer
break;
}
}
}
By the way, can't you use gotoAndPlay() instead of nextFrame()?
:edit:
The problem with your code is that on(release), you have this line:
So clickcounter will ALWAYS be 0
You have to initialize your variables before the eventHandler is called. Perhaps at the beginning of the script?