Skip to main content
Known Participant
Sep 6, 2024 2:13 AM UTC
Question

I can't next to frame

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 is closed to new replies. Start a new post to keep the conversation going.

    3 replies

    Known Participant
    Sep 6, 2024 2:15 AM UTC

    Sorry this miss some information 

    I don't know to delete this discussions 

     

    Translate
    Known Participant
    Sep 6, 2024 2:24 AM UTC
    kglad
    Community Expert
    Community Expert
    Sep 6, 2024 1:26 PM UTC

    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.

    Translate