I have a testing app I'm building in which I pull questions and answers from
SQL to build radio buttons on the fly. When you first test my movie the first
question works just fine and dandy. When the user makes a choice and clicks the
Next button the second questions loads but the radio buttons are completely
overlapped. Now if you right click and hit play, the second question's radio
buts load in the correct position. I obviously have a refresh issue but I can't
for the life of me figure it out.
I've attached my AS for the screen below.
The movie can be found @
http://cftest.mccormick.com/fsdstage/onlineT4.swf Any help greatly appreciated,
Glen
on (reveal) {
var iQuestionID:Number
WSCgetNextQuestionForUser.params = { TrainerUserID:_global.gTrainerUserID };
WSCgetNextQuestionForUser.trigger();
WSCgetNextQuestionForUser.addEventListener("result", fProcessQuestion);
function fProcessQuestion(ev:Object){
_global.gAttempts = 0;
for (var x=0; x< WSCgetNextQuestionForUser.results.length; x++){
var oTmp:Object;
oTmp = WSCgetNextQuestionForUser.results[x];
iQuestionID = oTmp.TRAINERQUESTIONID;
txtQuestionName.text = oTmp.TRAINERQUESTIONNAME;
txtQuestionDesc.text = oTmp.TRAINERQUESTIONDESC;
WSCgetQuestionChoices.params = { TrainerQuestionID:iQuestionID};
WSCgetQuestionChoices.trigger();
WSCgetQuestionChoices.addEventListener("result", fGotQuestionChoices);
}
if (x==0) {
txtQuestionName.text = "Thank you for playing!";
}
}
function fGotQuestionChoices (ev:Object){
for (var x=0; x<WSCgetQuestionChoices.results.length; x++){
var oTmp:Object;
oTmp = WSCgetQuestionChoices.results[x];
if (oTmp.TRAINERANSWERISCORRECT==1){
_global.gCorrectAnswerID = oTmp.TRAINERANSWERID;
}
createClassObject(mx.controls.RadioButton, ("radioButton"+x), x,
{label:oTmp.TRAINERANSWERNAME, value:oTmp.TRAINERANSWERID, fontFamily:"Verdana"
});
_root.application.data["radioButton"+x].move(txtQuestionDesc.x + 10,
txtQuestionDesc.y + txtQuestionDesc.height + x*20);
_root.application.data["radioButton"+x].data = oTmp.TRAINERANSWERID;
_root.application.data["radioButton"+x].selected = false;
_root.application.data["radioButton"+x].groupName = "TrainerAnswerChoices";
}
}
}