Flash - Millionaire

A concept on how a millionaire game would look in code.

Getting Started

Flash uses ActionScript and it's very messy. I completed this project in college while using the criteria the instructor requested.

On the main menu, it displays the logo and two buttons; play game and how to play. The simple code below is for redirecting the user to a different scene.

import flash.events.MouseEvent;



function playTheGame(event:MouseEvent){

function HowToPlay(event:MouseEvent){

The HowToPlay scene just displays text on how to play and contains a button to go back to the main menu scene.

UserInputName Scene

A simple textbox and submit button appears. It asks the player to fill out their full name and to continue. The player name will be printed on a fake cheque of the winnings earned when the game is over.

usernameInput.text = username;
currentBankedText = "Zero Dollars";

function startTheGame(event:MouseEvent){
    username = usernameInput.text;

To make things user friendly, I used String instead of Integer to display current bank amounts.

Questions Scene

In Millionare, there are questions and answers but not all answers are correct. I needed to come up with a solution on how to seperate this -- the easiest way was arrays. I could randomize the questions using arrays so that the game would not be boring and repetative.

var question:Array; //a string array that holds only questions
var answer:Array;   //a string array that holds the actual answer

//string arrays that holds the possible answer - one will always be correct determined by the array `answer`
var answerA:Array;
var answerB:Array;
var answerC:Array;
var answerD:Array;

An idea on what questions and answers would look like:

if(currentQuestion == 1){
    //Question 1 - $100 Dollars
    question = new Array(
    "What does JCL stand for?", 
    "What does COBOL stand for?", 
    "What does VB stand for?",
    "What does SQL stand for?",
    "What does HTML stand for?"
    answer = new Array(
    answerA = new Array(
    "Job Cobol Language", 
    "Common Business Object Language", 
    "Visual Basic",
    "Structured Query Language",
    "Hyper Markup Language"
    answerB = new Array(
    "Job Control Language",
    "CPU Business Oriented Language",
    "Virtual Basic",
    "Structured Question Language",
    "Hypertext Markup Language"
    answerC = new Array(
    "Job Creating Language",
    "Common Business Oriented Language",
    "Virtual Business",
    "Super Quiz Language",
    "Hypertext Language"
    answerD = new Array(
    "Just Crackling Lava",
    "Crappy Objects Language",
    "Visual Bam!",
    "Some Question Language",
    "Hilarious Type Mock Language"

The code is lengthy above but it was super simple to randomize a number to select a random question with it's corresponding answers.

//display question and answers on stage
index = Math.floor(Math.random() * question.length);

Knowing what I know now, I would have not done it this way. I would have setup a multi-dimensional array that shuffles each question and answer accordingly.

//concept                                                        correct answer below
//question, answer, answerA, answerB, answerC, answerD
question("What does JCL stand for?", "B", "Job Cobol Language", "Job Control Language", "Job Creating Language", "Just Crackling Lava",...);

Game Over

There is more coding in this project overall like the GUI interface but I'm not willing to give the entirety of the code away. The code below will display the userinput and winnings on a fake cheque on the screen to the player.




Image of Scoreboard


Everytime the player gets an answer right, this scene displays on the player's screen. The orange bar (shown at the 15th question; one million dollar question) will start at the $100 question and increment by the height of the box every time the player gets the question right. It's just a simple way of showing the current question and winnings. That means the spacing has to be perfect so the box isn't overlapping or going off course.