@wan Posted March 23, 2006 Share Posted March 23, 2006 anyone know how to make a random question using actionscript...or some random actionscript... i want to make a question like "who wants to be a millionaire"....the question change after we restart it again... please help me... i found it, but it's hard one... i can't understand..i want simple one.... please some body help me... aisya_mafia@yahoo.com Link to comment Share on other sites More sharing options...
erock32 Posted April 12, 2006 Share Posted April 12, 2006 You may wish to look at this incredible site...www.kirupa.comHas tons of tutorials. I searched for "random words" but nothing came up. It does discuss random colors. All you need to do is create an array of strings, each element in the array holding a string question.... yourArray[1] = "Chicken or egg?";Then just create a random function that is called on a certain trigger, which will randomly pick an element in your array.Hope this helped somewhat. Cheers. Link to comment Share on other sites More sharing options...
ashwani_nair Posted June 2, 2006 Share Posted June 2, 2006 anyone know how to make a random question using actionscript...or some random actionscript... i want to make a question like "who wants to be a millionaire"....the question change after we restart it again... please help me... i found it, but it's hard one... i can't understand..i want simple one.... please some body help me... aisya_mafia@yahoo.com<{POST_SNAPBACK}> As suggested kirupa.com is a very good site to get help from.I would like to suggest a method, i dont know if you find it simple or not.you may creat an xml file to store all the questions and answers as<xml> <info> <question>3 + 2 = ?</question> <answer>5</answer> </info> <info> <question>3 + 8 = ?</question> <answer>11</answer> </info> <info> <question>8 + 2 = ?</question> <answer>10</answer> </info> <info> <question>3 + 12 = ?</question> <answer>15</answer> </info></xml> so once you have your database of question and answer ready with you. You can load the xml into your flash movie and then split it to an array. This can be done as var myXML:XML = new XML();myXML.onLoad = function(success){ if(success){ // here you need to place code which will split the information in the xml object to say some array or object array accordiing to your convinience. }else{ trace("loading Failed"); }}myXML.load("/myxmlfile.xml"); once you have done this, you can just load the question to a dynamic textfiled placed on your stage and check if the answer is correct or not.Anyway selection of which question can be done by the function displayQuestion(Math.round(Math.Random() * theArray_arr.length)); The good thing about this is, when ever you want to change the set of questions or say to increase or decrease the number of quesitons.. u just have to replace the XMLHope this is of some help. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now