Lottery game using flash

Posted on 2005-03-22
Medium Priority
Last Modified: 2006-11-17
I have been asked to create a lottery game in flash. Are there any dir files of completed flash games or anything that might help e.g. random number generater etc
Question by:lukegriffiths110
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 18

Expert Comment

ID: 13602715
for random numbers you can use
myvar=random (1000);
this will come up with a number between 0 and 1000

It s a start
or you can use
Math.random() which gives you a number between 0 and 1


Expert Comment

ID: 13603233
good site with a lot of game tutorials:

LVL 16

Accepted Solution

vickerleung earned 2000 total points
ID: 13608905

Is EE's rule not to do the thing for members

However I can still provide you with the idea behind

The most difficult part within a lottery is that duplicate record is not allowed (I guess your game too, right)

So I will suggest you make a single number generator function and an array to store up the generated number

The prototype will be something as below

_root.number_requires = 6;      // say you wanna draw six times
_root.number_maximum = 100;      // the maximum number that can be drawn
_root.current_number = 1;      // the current number you are drawing
_root.temp_number = 0;            // for storing the number that will be insert to array
_root.number_array = new Array ();
_root.duplicate_checker = new Boolean ();

_root.loop_num = 0;            // temporary loop number
_root.loop_num_2 = 0;

function draw_number ()
      _root.temp_number = random (_root.number_maximum) + 1;
      _root.duplicate_checker = FALSE;      
      if (_root.current_number != 1)
            for (_root.loop_num = 0; _root.loop_num < _root.current_number - 1; _root.loop_num++)
                  if (_root.temp_number == _root.number_array [_root.loop_num])
                        _root.duplicate_checker = TRUE;

      if (_root.duplicate_checker == FALSE)
            _root.number_array [_root.current_number - 1] = _root.temp_number;
      if (_root.current_number <= _root.number_requires)
            draw_number (); // recursive call itself until all numbers drawn

draw_number ();
trace (_root.number_array); // put the answer out


Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to how to record live broadcast.
Suggested Courses
Course of the Month10 days, 18 hours left to enroll

770 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