Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3
  1. #1
    Member Tristessa's Avatar
    Join Date
    Nov 2004
    Location
    Kingston, Ontario
    Posts
    94
    Member #
    8215
    I need some help with Flash ActionScript.
    I've created a simple quiz game with several true or false questions. The game script that I found works fine but I needed to make the questions to appear in random order. I found a "randomize" script online.

    Here's the script that I'm using to randomize:

    on (release) {
    gotoAndPlay(frameNumber);
    choices = ['q1', 'q2', 'q3', 'q4', 'q5', 'q6', 'q7', 'q8', 'q9'];
    frameNumber = choices[random(choices.length)];
    }


    I need help with script so that the questions appear only once... To randomly cycle through each question (labeled q1-9)

    Once it goes through all the questions it should go to the "end sequence".

    I'm still pretty new to Flash and ActionScripts...
    Any help would be appreciated.
    Thanks.

  2.  

  3. #2
    Senior Member zionlocke's Avatar
    Join Date
    Jan 2003
    Location
    .: l33t Basement :.
    Posts
    736
    Member #
    483
    Liked
    3 times
    You could have a second array of boolean variables, variables that store true and false and change the value to true when the question has been used it would be good to use a for loop to randomize your questionaire. If you are lost, let me know.

    I can help you out tomorrow by writing a script based off what your giving us. Let me know if you aren't following me, and I'll be sure to help.
    Cheers, zionlocke :chinese:
    Links: Zion Creation | Blog

  4. #3
    Senior Member zionlocke's Avatar
    Join Date
    Jan 2003
    Location
    .: l33t Basement :.
    Posts
    736
    Member #
    483
    Liked
    3 times
    all right:

    on (release) {

    //original choices array
    choices = ['q1', 'q2', 'q3', 'q4', 'q5', 'q6', 'q7', 'q8', 'q9'];
    //boolean variable array
    chosen = ['a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9'];
    //stops an infinite loop
    destroyloop = 0;

    //searching for an unused question
    while(chosen[notused] == true){
    notused = random(choices.length);
    destroyloop++;
    if(destroyloop == 9){
    chosen[notused] = false;
    }
    }

    if(destroyloop != 9){
    //assigning the new question
    chosen[notused] = true;
    frameNumber = choices[notused];
    gotoAndPlay(frameNumber);
    } else {
    //endgame is the frame of your end game menu
    endgame = 12;
    gotoAndPlay(endGame);
    }
    }
    Cheers, zionlocke :chinese:
    Links: Zion Creation | Blog


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 03:34 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com