Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,471
There are 1196 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

what is wong with this counter for actiosncript?

Thread title: what is wong with this counter for actiosncript?
Closed Thread    
    Thread tools Search this thread Display Modes  
04-29-2005, 01:28 AM
#1
1901gt is offline 1901gt
Status: Senior Member
Join date: Mar 2005
Location: Singapore
Expertise: Web Design, XHTML/CSS
Software: Photoshop, Illustrator
 
Posts: 861
iTrader: 8 / 100%
 

1901gt is an unknown quantity at this point

  Old  what is wong with this counter for actiosncript?


on (release) {
clickcounter = 0;
if (valueNum == 20) {
nextFrame();
}
else if (clickcounter eq 0) {
nextFrame();
nextFrame();
nextFrame();
}
else {
nextFrame();
nextFrame();
nextFrame();
nextFrame();
clickcounter += 1;
}
}
Each time i test scene and type any other value other than 20, it only play the else if one but never the else one. I want user to be given 2 tries to try guess and the answer. After 2 tries, a popup will be shown saying "Incorrect, the correct answer is 20."

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?

Closed Thread    


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed