Skip to main content
Known Participant
September 6, 2024
Question

I can't next to frame

  • September 6, 2024
  • 1 reply
  • 142 views

Hello i'm new in Adobe Animate , I wanna make a quiz multiple choice , I want my quizzes to be random when they start and when they repeat. So I try to make the question randomly 

I'm use 3 frame 

1. Button Start 


mc_kuis is the intance name from frame 2
loadPertanyaan is function for me to load the question in dynamic text here the code :

 

variabel I use

//variabel global
var data = [{
	pertanyaan_text: "1+1",
	jawaban: "2",
	jawabann: ["1", "3", "2"]
}, {
	pertanyaan_text: "Berapa Jumlah hari dalam Seminggu",
	jawaban: "1",
	jawabann: ["5", "7", "8"]
}, {
	pertanyaan_text: "Bumi Merupakan Planet Ke-",
	jawaban: "0",
	jawabann: ["4", "5", "8"]
}, ];

var indexPertanyaan = 0;
var currentPertanyaan;

 

function loadPertanyaan(){

//Random Question
data= mixed(data);
	
//Take the first new question
currentPertanyaan = data[indexPertanyaan];
	
//load pertanyaan to dynamic text
mc_kuis.txt_Pertanyaan.text = currentPertanyaan.pertanyaan_text;
	
}


Thank for helping me solve this prolem 

    This topic has been closed for replies.

    1 reply

    Known Participant
    September 6, 2024

    Sorry this miss some information 

    I don't know to delete this discussions 

     

    Known Participant
    September 6, 2024
    kglad
    Community Expert
    Community Expert
    September 6, 2024

    the easiest way to do anything like this is to create an array of the objects your want to randomize without repeats and then use the fisher-yates shuffle method.