# Number match game question

Hi, experts:

I have this script should show a formula ( ex. 45 - 15 = ? ) and on the buttons, there should have random number with one of right number on it. So, in this case, there should be a 30 on the button. Than click on the right number button. Then on the left corner, a sign would show " pass ".

This is a very simple math game. However, I could not make it working. It could not gerenate problem. Also, if problem gerenate, I also need one of button to match the number that generate from problem. I would like to ONLY gerenate number from 20 to 80. No number under 20 and over 80.

I attach a demo and please download it @ http://www.brianlinstudio.com/question/numbers.zip ....... What I can do to solve the problem ? If you need to return the solved file, please upload to http://www.brianlinstudio.com/uploadform.htm .... thanks so much !!
###### Who is Participating?

Commented:
ok, mingchih,

go have a look here, and see if it's what you had in mind.

http://www.geocities.com/bluegenie_sa/ee/test.html

I just made this up now, and i've changed your code quite a bit, it uses some old code but it works.

the fla is available

http://www.geocities.com/bluegenie_sa/ee/test.zip

ps. developed in mx2004 as1.0
0

Commented:
hi.

1. do you want it to include all operations, ie. +, -. * and /?

2. when you say numbers from 20 - 80, is that for the answers only?

blu

0

DesignerAuthor Commented:
hi, Blu
For your 1st question, I only want + to show up.......2. 20 to 80 should be the question.... answer can be any number..... and one of button should show the answer..... other buttons are any number but should only range from 20 to 80 too...... thanks :)
0

Commented:
what i did was:

1. generate 2 random numbers within  20 and 80 - doesn't matter if they're the same, cause you can have 55+55.

2. work out the answer and store in solution variable.

3. generate another 7 random numbers, checking to see that there are no duplicates (7 because i'll add the correct answer to make up 8 options)

4. put all the options into an array.

5. shuffle that array (otherwise correct answer will always be 1st option)

6. populate my movieclip btns with the options.

7. create a function to check what user has selected.

8. convert the text in the selected option to a number, and compare to solution, if same go to pass frame, if not do nothing (tracing at the moment, you can change it how you want)

9. I also added a gobackto 1 loop after passing, so it starts again, you can action accordingly.

blu.

0

Commented:
I'll just give you an idea on how to implement that....

first set a button that will be holding the correct answer...which is randomize...

the button that holds the correct answer/number will no longer generate  numbers from 20-80...
0

DesignerAuthor Commented:
wow, you are amazing.... this is what I need....new scripting is more smooth then what I had.....thank you !! :) I may post another question like this but much more complex.....hope you will have time to look at it. :)

Brian
0

Commented:
right now, i'm sitting at work bored cause I can't my stuff to work, so its a pleasure to be able to get something right.

:-)
0

DesignerAuthor Commented:
0

DesignerAuthor Commented:
Hi, Blue-genie:
I post the silimar question at http://www.experts-exchange.com/Web/WebDevSoftware/Flash/Q_21407018.html .... please take a look if you have time.... :))
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.