PDA

View Full Version : problem in using destroyObject()


ajuka
09-12-2006, 06:15 AM
I'm creating set of choices(radiobutton) using createClassObject for a question using array. If i click next button the another set of choices(Radiobutton) should be created and also it should destroy the previously created choices. but it is not working.

My code is as follows

//creating component
function choiceDisp(id) {
ypos = 80;
for (var i = 0; i<choiceArr[id].length; i++) {
choiceLabel = choiceArr[id][i];
this.createClassObject(RadioButton, "choice"+id+i, this.getNextHighestDepth(), {label:choiceLabel, groupName:"radioGroup"});
n = eval("choice"+id+i);
n.move(50, ypos);
ypos += 40;
}
}

// for destroying component

function destroyObj(id) {

for (var i = 0; i<choiceArr[id].length; i++) {

y="choice"+id+i;
destroyObject(y);
}
}


What mistake is there?
Pls help me out.