Hi all,
I'm creating a simple class that has an method that will receive an array as a
parameter and store it inside the class in a property. This gives me the error
below and I'm stuck. Also I would like to know why if I change the code inside
the method setGabarito to just ( aRespGabarito = p1 ) it works...
TypeError: Error #1009: Cannot access a property or method of a null object
reference.
at trueFalse/setGabarito()
at tf_teste_fla::MainTimeline/frame1()
this is the class:
package {
import flash.display.Sprite;
public class trueFalse extends Sprite{
//propriedades
var nome:String;
var aRespGabarito:Array; //tera o gabarito do exercicio
//construtor
public function trueFalse(p1:String) {
nome = p1;
}
public function setGabarito(p1:Array) {
var tamanho = p1.length - 1 // o indice comeca com zero entao tem 1
elemento a menos.
for (var r = 0; r <= tamanho; r++ ) {
var data:Array = p1[r];
aRespGabarito[0] = data; <<-- ERROR HERE
trace(aRespGabarito[0]);
}
}
}
}
and this is the code inside the test movie:
var usuario:trueFalse = new trueFalse("aa");
var arrQuestao:Array = new Array();
arrQuestao[0] = ["btV1","btX1","btV1",0];
arrQuestao[1] = ["btV2","btX2","btX2",0];
arrQuestao[2] = ["btV3","btX3","btX3",0];
usuario.setGabarito(arrQuestao);
thanks for any help,
rodrigo.
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders