Groups | Blog | Home
all groups > macromedia flash flash remoting > september 2004 >

macromedia flash flash remoting : Radio buttons overlap - Help


AGKnight
9/3/2004 3:24:02 PM
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";
}
}
}

Adrian Cadena
9/14/2004 4:50:29 PM
I think your erros is the on(reveal) use I think you should try to use an event
handler , so you must create a Broadcaster to receive the click an evaluate de
Data received, once the Broadcaster receives it must know to wich function to
pass it.

Then you can just create a singkle timeline with LABELS on it or you can use
Load Movie to load the next step.

Regards,

Adrian cadena
PS: you can find more a bout Broadcasting at MACROMEDIA DOCUMENTATION ON THE
LAST FLASH UPDATER 7.02
AddThis Social Bookmark Button