Comunidad de diseño web y desarrollo en internet online

Ayuda con un script

Citar            
MensajeEscrito el 07 Oct 2004 04:52 pm
Baje un script de un italiano que esta bastante bueno pero tengo un problema con el orden de las respuestas, no soy programador pero algo se, esto lamentablemente me la gano.
Es un .fla de un quiz que te da las preguntas y las respuestas en forma aleatorea pero yo necesito que las respuestas me las de en orden, he intentado con for, borrando el ranAns, quitando el random, NO HE PODIDO!!!!!

stop();

/**************************************
here we include the external file with
the list of our question and answers
**************************************/

#include "questions.as"

/*************************************/

toDisplay = 12; // how many question to display


// Random generation Questions
Object.prototype.nextAnswer = function(){
ranQuestion = random(domande.length)
for(var i = 0; i < domande.length; i++){
if(ranQuestion == tempArray[i]){
var prosegui = false;
nextAnswer();
break;
}
var prosegui = true;
}
if(prosegui){
tempArray.push(ranQuestion);
return ranQuestion;
}
}



// Remove the old points
Object.prototype.removePoints = function(what,keep){
for(var clips in _root.box){
if(_root.box[clips]._name.substring(0,_root.box[clips]._name.length -1) == what.substring(0,what.length-1) && _root.box[clips] != _root.box[what]){
_root.box[clips].point._visible = 0
}
}
}


// remove old answers
Object.prototype.removeAllAnswer = function(){
for(var answer in _root.box){
removeMovieClip(_root.box[answer])
}
}

// Build the Question
Object.prototype.buildQuestion = function() {
creaNuovoArray();
countAnswer++;
delete myChoice;
// call function to generate a random unique question
nextAnswer();
numero_domanda = "PREGUNTA N°" + countAnswer; // current Question
domanda = (domande[ranQuestion][0]) // Assing Question txt
removeAllAnswer();
// build answers;
for(var i = 0 ; i < domande[ranQuestion][2].length ; i++){
nextRisposta();
duplicateMovieClip("box.answer","answer"+i,i)
box["answer"+i].y_fin = answer0._y + (40*i)
box["answer"+i].txt = domande[ranQuestion][2][ranAns]
if(ranAns == domande[ranQuestion][1]){
box["answer"+i].thisChoice = true
} else {
box["answer"+i].thisChoice = false
}
}
box.answer._visible = 0
}

// Building random answers
function creaNuovoArray(){
delete tempRis;
tempRis = new Array();
}

Object.prototype.nextRisposta = function(){
ranAns = random(domande[ranQuestion][2].length)
for(var i = 0; i < domande[ranQuestion][2].length; i++){
if(ranAns == tempRis[i]){
var prosegui = false;
nextRisposta();
break;
}
var prosegui = true;
}
if(prosegui){
tempRis.push(ranAns);
return ranAns;
}
}


se que tengo que modificar el "Building random answers" y me las va a tirar en orden.... PERO COMO??????????

Por bk

1 de clabLevel



 

unknown
Citar            
MensajeEscrito el 07 Oct 2004 05:44 pm
aqui esta el fla y todo.

http://bk.ingaero.cl/Multiplechoicequiz.zip

Por bk

1 de clabLevel



 

unknown
Citar            
MensajeEscrito el 08 Oct 2004 03:31 am
En donde dice

Código :

ranQuestion = random(domande.length);

ponle

Código :

ranQuestion = 0;

Y funcionara

Por Freddie

BOFH

53 tutoriales
597 articulos
43 ejemplos

Genero:Masculino   Admin

Conserje de Cristalab

unknown

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.