View Single Post
04-29-2005, 10:04 AM
#2
Koobi is offline Koobi
Koobi's Avatar
Status: Member
Join date: Apr 2005
Location:
Expertise:
Software:
 
Posts: 312
iTrader: 0 / 0%
 

Koobi is on a distinguished road

  Old

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:
Code:
clickcounter = 0;
So clickcounter will ALWAYS be 0
You have to initialize your variables before the eventHandler is called. Perhaps at the beginning of the script?