?
Solved

Number match game question

Posted on 2005-04-29
9
Medium Priority
?
276 Views
Last Modified: 2010-04-03
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
Comment
Question by:Brian Lin
  • 4
  • 4
9 Comments
 
LVL 39

Expert Comment

by:blue-genie
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

by:Brian Lin
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

by:
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 39

Expert Comment

by:blue-genie
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

by:y_o_y
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

by:Brian Lin
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

by:blue-genie
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

by:Brian Lin
ID: 13892997
and additional explain is very helpful !! :)
0
 

Author Comment

by:Brian Lin
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

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.

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question