Solved

# Number match game question

Posted on 2005-04-29
Medium Priority
276 Views
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 !!
0
Question by:Brian Lin
• 4
• 4

LVL 39

Expert Comment

ID: 13892733
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

Author Comment

ID: 13892755
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

LVL 39

Accepted Solution

blue-genie earned 2000 total points
ID: 13892948
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

LVL 39

Expert Comment

ID: 13892957
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

LVL 3

Expert Comment

ID: 13892981
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

Author Comment

ID: 13892983
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

LVL 39

Expert Comment

ID: 13892996
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

Author Comment

ID: 13892997
0

Author Comment

ID: 13893212
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

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
###### Suggested Courses
Course of the Month15 days, 17 hours left to enroll