Hi, I’ve been using the following script to randomly display options for a quiz similar to who wants to be a millionaire:
var answersArray:Array = new Array("Geography", "Maths", "English", "French");
var correctAnswer:String = answersArray[0];
answersArray.sort(function () {
return Math.round(Math.random());
});
for (var i = 0; i < answersArray.length; i++) {
this["answer" + i].text = answersArray*;
}
I can identify the correct answer by listing it as the first item in the array. This works great for displaying text based answers, but how easy would it be to do exactly the same thing with images.
For example, instead of the answer options being ‘Geography’, ‘Maths’ etc etc - could they be 4 different images loaded from the library?
Was thinking I could probably do it with empty container MCs instead of the existing dynamic text boxes and load them in with attachmovie?? Sound feasible? Sorry if this is a silly question - still quite new to this!