ActionScript 3.0 :: Load Random Quiz Questions From Arrays?
Nov 7, 2009
I am fairly new to AS3 so I am having a go at creating my own game of Who Wants to be a Millionaire?, thought a quiz game of sorts may be simplish. Right now, I am having trouble working out how to load shuffled questions. This is the code I have so far[code]...
View 1 Replies
Similar Posts:
Jul 21, 2010
Anyone know where to start thinking about logic for an XML quiz with multiple correct answers, that when the user gets the question right, that question is removed from the random array of questions so we never need to answer it again?
View 0 Replies
Nov 18, 2009
I'm trying to create a simple quiz that picks questions from an XML file, then checks the answer the user enters against the answers stored in the same XML file. Every time you press blue_btn it should bring up a new question. Right now I'm stuck -- it shows only the last question in the XML file, when I enter the right answer it tells me it's wrong, and when I press blue_btn again nothing happens.
[Code]....
View 4 Replies
Oct 18, 2006
I wanted to randomise my quiz questions and to allow all questions to appear but no similar questions should appear twice. I tried to use arrays to do it but I kept having errors.
View 8 Replies
Oct 13, 2011
I want one question to be displayed (just text) and then the user will type in their answer (just text) then they should press a button to move onto the next question to do the same. The number of questions is not set and depends on how many questions the asker has created, these are passed through flashvars from the backend database.
So can I just do this in the one frame with a loop or something going through each param in flashvar ? Or would a better way be reload the page (it's going on a website) after each question answered passing the flash a single question.
View 3 Replies
Oct 13, 2011
I am getting questions from the database (just text) and then passing them to flash via flash vars.I want one question to be displayed then the user will answer (text) and click a button and then the next question will be displayed for them to answer and so on.I am not hoping for overly specific advice but as I am very new to flash/actionscript am just looking for broad advice (or links ?) on how to approach this. Can I do it all from one frame just using actionscript?I think what I am really after (assuming I am not way off track) is if all the questions should be handled at once which I guess will require some kind of loop that listens for some buttonclick event to move to the next question ..... or be 'reloading' the flash movie and dealing with only 1 question at a time.
View 2 Replies
Jun 7, 2010
I'm working on a quiz-style piece right now and in short it's several pages of multi choice questions, each rewarding a certain point amount that is added up at the end and given specific results based on the point range scored. (i.e. 10-20 = good, 21-30 = great... etc)
For code I've stopped here:
if (answercheck == 40 - 52){
trace("Feedback: Range 40 - 52");
form.gotoAndStop(3);
form.AnswerTotal.Number = answercheck;
}
Answercheck is the var with the total points accumulated. Form is the mc with the feedback frames based on their point totals. AnswerTotal is the dynamic text box I'm trying to load the exact point total the user acquired into at the end.
View 2 Replies
Feb 10, 2010
For my project i am creating a quiz on the Romans. There are only three questions that the user must answer with three possible answers in frames 3,4 and 5.I want to know the code that would help me to allow a Jpeg (an evaluation of the answer given on each frame) to be placed on frame 6 ready for the user to receive feedback for each answer they have given. So when the user selects an answer, the corresponding jpeg to that answer is placed ready on frame 6 for their arrival after they have answered the third question.
View 1 Replies
Aug 13, 2004
I have made a quiz which has 20 questions. 15 questions are asked at random. However, being at random some questions are repeated. How do I shuffle questions rather than use random?
View 4 Replies
Apr 6, 2011
Im building an activity whereby I want random math questions to appear and for them to be addition, subtraction, division and multiplication with just two integers where the answer is never more than 50
so far I have
ActionScript Code:
genQuestion.addEventListener(MouseEvent.CLICK, onGenerate);
function onGenerate(e:Event = null):void
[code]....
which randomly generate addition questions whereby each integer couldn't be more than 25. But this isn't right because I could also have 40 +5 and it still be under 50.
View 6 Replies
Jun 8, 2009
i have a quiz with 20 questions and all of its answers in 2 different arrays. I want to know how i can make those 20 questions and the all of the answers appear in a random order when anyone takes the quiz.
View 6 Replies
Jun 9, 2009
Hey i am making a quiz which is going to have 20 questions and i have about 40 question in the questions array. make a variable which will hold the 20 random question so
for eg
var arrQuestion:Array = [ 40 questions in here separated by commas]
var randQuestions:int = arrQuestion.length-1;
but that just sets randQuestions to the arrQuestion's length now how do i set the variable randQuestion with 20 questions that are randomly picked from arrQuestion.
View 3 Replies
Dec 15, 2006
i am building the results screen of a quiz and for some reason, my traces to these arrays are showing as undefined. Here is the code on the Results frame....
[Code]...
View 1 Replies
Jun 21, 2009
i am making a quiz. My problem is that once the user completes the quiz and wants to start again the quiz is already on the last question. How do i make it so that once the user clicks start again the questions and answers arrays start from the beginning, sort of reset themselves.
View 1 Replies
Sep 2, 2010
i had a project in my software design. it is "music games quiz" this is the scenario.. the music is random.(its working now) but my button (as 4 chooses) is the problem now. why? my question is, how the button would be random? so when the music is playing the button of the correct answer must be there also.
View 2 Replies
Jul 21, 2010
I have a quiz app. All data is in an xml file. Right now when the user starts the application he/she has to pick a chapter from a combobox and all questions for that chapter get loaded. What I'm trying to do is have only one chapter instead of multiple in my xml file and remove the combo box completely. So when the user starts the application the chapter gets loaded automatically. How can I have the quiz load automatically and not when the user selects the chapter from the combobox.
ActionScript Code:
function goReview(evt) {
myRoot=evt;
goXML("XMLs/review.xml");
} function goXML(url) {
myXML.ignoreWhitespace=true;
[Code] .....
View 2 Replies
Jan 21, 2009
I am trying to check input answer against random display from array. but sometime it trace not correct when it is correct this is the code i use
[CODE]....
View 7 Replies
Dec 22, 2010
How can I make an array in flash as2 and from there select 12 values assigning them to twelve different variables?So far I got this:
quotes = new Array();
quotes[0] = "one";
quotes[1] = "two";
[code]....
View 2 Replies
Feb 13, 2011
I'm trying to build a bingo card, that will show random words in different locations each time you reload the page. It's 5x5 grid. I'm planning to set up 25 arrays (for each text field on my card), containing lists of the same 25 words. I have a code that pulls random words from each array into my text fields, but I can't figure out how to prevent the words from repeating on the card. A different word should be pulled out from each array.
Here is my code so far:
var words1:Array = ["word","table","lamp"];
var words2:Array = ["word","table","lamp"];
var words3:Array = ["word","table","lamp"];
[Code].....
View 19 Replies
Feb 24, 2010
I got this function, which is sorting my array in a random way.
private function randomSort(objA:Object, objB:Object):int {
return Math.round(Math.random() * 2) - 1
}
[code].....
View 7 Replies
Aug 18, 2009
I'm trying to find the way to draw random elements from different arrays. I have three dynamic boxes (box1, box2, box3) and a button (bt_2). I have three arrays:
positiveNumbers:Array,
negativeNumbers:Array, and
fractionNumbers:Array.
I have managed to draw a random element from each array and display it on each box.
PROBLEM: When button (bt_2) is clicked, I would like each box to draw a random element from any array. However, arrays positiveNumbers and negativeNumbers are int, while fractionNumbers is Number. If I use Math.round all elements from fractionNumbers will be positiveNumbers.How to handle this?Here is my code:
// setting the arrays//
var wholeNumbers:Array = new Array (50);
var negativeNumbers:Array = new Array[code]....
View 0 Replies
Jan 26, 2011
For example, when users are connecting to this application they are given a userid var, then it's inserted into the array. So, i'm using chosenUser = usersOnlineArray[Math.round((Math.random()*usersOnlineArray.length))]; to pick another random user. But i need to make sure it doesn't pick the userID they personally were assigned so they don't end up getting themselves. how would i use that code but tell it to "remember, make sure you dont pick userid" maybe I could do something like
[Code]...
View 2 Replies
Aug 16, 2011
I have come a little closer with my project, and still need some help please. I have 5 Flvs which i want to play randomly on this page [url]....The .fla file I have created contains this code:
var files:Array = [ "Sz01Puppet.flv", "Sz02Puppet.flv", "Sz03Puppet.flv", "Sz04Puppet.flv", "Sz05Puppet.flv" ];
var shuffledFiles:Array = shuffleArray(files);
//quick test[code].....
This script works. In the Output every flv is listed randomly, and then repeated. Next up i want this AS Script to work with an FLV Component.But how to I get that to work?In my library I have the 5 flvs, and flvplayback component.I dragged the FLVPlayback component to the stage, but I can only add one flv in the source. How do I get my working actionscript to work with the FLVPlayback component.how my screen looks like.
View 2 Replies
Dec 3, 2005
I have tried creating 4 variables with arrays with random values where there are no two variables with the same value at the same place in the array. For example, if the 27:th value in one variable is 3, then none of the other variables must have 3 as the 27:th value.I thought the part marked blue would do it (I have also tried it with the "while" exchanged for an "if").
Code:
var totalQuestions = 50;
var correctAnswers = new Array();
var wrongAnswers1 = new Array();[code]...
View 4 Replies
Sep 30, 2006
I want a movieclip consisting of a dynamic text box that, from the time it's loaded onto the stage, loads a randomly selected text string from an array, and continues to loop until the clip is removed from the stage. I also want the text strings to appear in the text box for random intervals between 500 and 3000 milliseconds.
While I've found tutorials here and elsewhere on loading one element from an array, usually triggered by a button, I don't know how to combine/alter it with the other elements.So I want this movieclip on the stage randomly flashing phrases from an array, some for a barely perceptible time, and others for a readable time.
View 3 Replies
Feb 11, 2009
I've been putting data into an array via XML, and then selecting at random an image string to load in a pic at random. But whilst doing this, I wanted to remove the String from the Array that I have just used, so I don't get repetition of the same image in the output. I initially thought that pop would remove the string I had just used - But of course it Removes the last value in the Array instead, which doesn't really help.
Ok - so how about randomizing the data once inside the Array, after it has been pulled in from XML!? That way I can load in the 'last' image, and then pop it out! Keeping a randomized selection of images each time 'it' is loaded
View 2 Replies
Aug 17, 2007
im playing with the load random movie (but loading a random xml file instead) based on the wonderful tutorial from front page and was wondering whether anyone can show me the work around/upgrade to AS2 for this bit of script since im publishing to Flash 8 /AS2 and it doesnt work:
[Code]....
View 5 Replies
May 31, 2009
I want to take an XML file and load it into simple arrays.
[Code].....
where i will represent the question number. P.S. I would like this answered today. I'll PayPal the first reply with working code $5.
View 3 Replies
Dec 24, 2009
How I can make this script lo load mp3 files via an external xml file like music.xml and if is possible to load random
Code:
music = new Sound();
music.onSoundComplete = function() {
[code]....
View 1 Replies
Dec 17, 2009
I'm creating a little movie player. i have 3 buttons on stage that when clicked i want to load a movie clip from the library into my "container" MC already on stage. basically i want it so when i click on a button it changes the first and only array item to the one i want to load. therefore replacing the existing one. (so there is only one in the container at a time).[code]...
View 9 Replies