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 @ ....... What I can do to solve the problem ? If you need to return the solved file, please upload to .... thanks so much !!
Brian LinDesignerAsked:
Who is Participating?
ok, mingchih,

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

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

ps. developed in mx2004 as1.0

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?


Brian LinDesignerAuthor 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 :)
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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.


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...
Brian LinDesignerAuthor Commented:
wow, you are amazing.... this is what I 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. :)

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.

Brian LinDesignerAuthor Commented:
and additional explain is very helpful !! :)
Brian LinDesignerAuthor Commented:
Hi, Blue-genie:
I post the silimar question at .... please take a look if you have time.... :))
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.

All Courses

From novice to tech pro — start learning today.