Create an actions layer that extends through all your pages and define a score variable...
var score = 0;
Maybe for each correct answer you increment the value by 1...
score += 1;
When you get to the end or wherever, you have a textfield and you use the score value in it in some way...
tField.text = "You answered "+score+" out 10 correctly";
Thanks Ned, as kind and helpful as always!
I will give it a go and report back!
Hi, thanks Ned,
I managed to do it!
I put on the first frame:
score = 0;
Then on each of the pages to move:
on the "correct" buttons: (If you click the correct button the script counts it for you)
score = score+1;
On the last frame I made a "score" and "percent" variable with dynamic text box and on the last frame I put the actionscript:
percent = score*20 (the twenty being five questions 5 x 20 = 100%)
So, it's all good, thank you. But I want to get a little cheeky here...
I want to add a sort of highscore box which will let users put in their name and let their score be automatically put in next to the name. Is this possible?
Thanks a bunch, Ned!
1 person found this helpful
It's possible, but you'll have to get more than just cheeky to do it if you intend for that data to be saved somewhere and recovered. You need to look into working with databases/files and server side processing scripts (like php).
Here's a link to a video tutorial that will give you an idea of what you will need to learn about.