corsasport.co.uk
 

Corsa Sport » Message Board » Off Day » ActionScript experts


New Topic

New Poll
  Subscribe | Add to Favourites

You are not logged in and may not post or reply to messages. Please log in or create a new account or mail us about fixing an existing one - register@corsasport.co.uk

There are also many more features available when you are logged in such as private messages, buddy list, location services, post search and more.


Author ActionScript experts
James
Member

Registered: 1st Jun 02
Location: Surrey
User status: Offline
27th Feb 05 at 16:33   View User's Profile U2U Member Reply With Quote

Im trying to make an If statement where the user enters a number and if it matches a certain number (8 in this example) then a text box produces the word correct, and if it doesnt, the text box produces the word wrong. This is the code i have:

on(press){
if (Answer8.text = "8") {
Result8.text = "Correct"
} else {
Result8.text = "Wrong"
}}



It works if you type in 8, but if you type in anything else, it changes what you typed to 8 and then says correct Any ideas?

Thanks in advance
Ian
Site Administrator

Avatar

Registered: 28th Aug 99
Location: Liverpool
User status: Offline
27th Feb 05 at 16:45   View Garage View User's Profile U2U Member Reply With Quote

Answer8.text = "8" is assignment not comparison, and is always true, ie. the assignment always succeeds.

You might want Answer8.text == "8") ?
James
Member

Registered: 1st Jun 02
Location: Surrey
User status: Offline
27th Feb 05 at 16:47   View User's Profile U2U Member Reply With Quote

Mazin it worked, Cheers Ian ur a lifesaver

 
New Topic

New Poll

Corsa Sport » Message Board » Off Day » ActionScript experts 24 database queries in 0.0051260 seconds