I’m having a tough year so far. Why do I get this error? The red text is the line with the error.
//I use this emptyContainer to easily clear objects at certain times (between questions, etc)
if(!Boolean(this.getChildByName('emptyMC')))
{
var emptyContainer:MovieClip = new MovieClip();
emptyContainer.name = "emptyMC";
this.addChild(emptyContainer);
}
var remainder:int = 0; //This remainder is used to toggle the x setting from side to side.
if(!charCountTest) //If the answer character count is less than 190, use narrow buttons.
{
mcQuestBack.height = 225;
for(var i:int = 0; i < xmlFile.questions.question[questIndex].answers.answer.length(); i++)
{
remainder = i % 2;
var ansBacking:btnAnsBack = new btnAnsBack();
ansBacking.width = 363;
ansBacking.x = mcQuestBack.x + ((ansBacking.width + 8) * remainder);
if(i <= 1)
{
ansBacking.y = mcQuestBack.y + mcQuestBack.height + 8;
}
else if(i > 1 && i < 4)
{
ansBacking.y = mcQuestBack.y + mcQuestBack.height + 8 + 105;
}
else if(i >= 4)
{
ansBacking.y = mcQuestBack.y + mcQuestBack.height + 8 + 210;
}
ansBacking.buttonMode = true;
ansBacking.label = xmlFile.questions.question[questIndex].answers.answer*.content;
ansBacking.addEventListener(MouseEvent.CLICK, handleChoice);
emptyContainer.addChild(ansBacking);
emptyContainer.setChildIndex(ansBacking,0);
if(xmlFile.questions.question[questIndex].answers.answer*.@correct == true)
{
correctAns = xmlFile.questions.question[questIndex].answers.answer*.content;
}
var choiceText:TextField = new TextField();
choiceText.defaultTextFormat=formatWhite;
choiceText.multiline=true;
choiceText.selectable=false;
choiceText.mouseEnabled = false;
choiceText.wordWrap=true;
choiceText.border=false;
choiceText.width=330;
choiceText.autoSize=TextFieldAutoSize.LEFT;
choiceText.text = xmlFile.questions.question[questIndex].answers.answer*.content;
//choiceText.y = ansBacking.y + (30 * (26/choiceText.height));
//choiceText.x = ansBacking.x + (ansBacking.width/2) - (choiceText.text.length * 3.3);
[COLOR=#FF0000]emptyContainer.ansBacking.addChild(choiceText);[/COLOR]
}
}