I am creating a dynamic contact form in FLASH MX and having difficulty in placing radio buttons in there proper Y position. Because I have to create a new movie clip, the x & y positions are different than the root. Is there simple solution for the proper placement of dynamically create mc within loop?
// ARRAY: DISPLAY NAME | FORM NAME | FORM TYPE
contact = [["First Name", "FistName", "textField"], ["Last Name", "LastName", "textField"], ["Company Name", "CompanyName", "textField"], ["Address", "Address", "textField"], ["City", "City", "textField"], ["State", "State", "textField"], ["Zip", "Zip", "textField"], ["Phone Number", "PhoneNumber", "textField"], ["Email Address", "Email", "textField"], ["WebSite", "WebSite", "textField"], ["Type of Inquiry:", "InquiryType", "textArea"], ["Comment:", "Comment", "radioButton"], ["How did you hear about us?", "HowHear", "textField"], ["Subscribe", "Subscribe", "checkbox"]];
function addTextFields(num) {
iYoffset = 0;
for (i=1; i<num; i++) {
tempContactLabelVar = contact[i][0]+"1_txt";
tempContactVar = contact[i][1]+"2_txt";
trace(tempContactLabelVar)
;
trace(tempContactVar);
if (contact[i][2] == "textField" || contact[i][2] == "textArea") {
if (contact[i][2] == "textField") {
createTextField(tempContac
tVar, 100+i, 10, iYoffset, 150, 20);
} else if (contact[i][2] == "textArea") {
createTextField(tempContac
tVar, i, 10, iYoffset, 150, 60);
eval(tempContactVar).multi
line = true;
}
eval(tempContactVar).type = "input";
eval(tempContactVar).textC
olor = 0x000000;
eval(tempContactVar).borde
r = true;
eval(tempContactVar).selec
table = true;
eval(tempContactVar).taben
abled = true;
eval(tempContactVar).tabIn
dex = i;
eval(tempContactVar).wordW
rap = true;
eval(tempContactVar).backg
round = 0xFFFFFF;
// add text decoration here
rf = new TextFormat();
rf.size = 18;
rf.font = "Arial";
FistName_txt.setTextFormat
(rf);
} else {
attachMovie("RadioButton",
"RadioButton_mc", i);
RadioButton_mc._x = 10;
RadioButton_mc._y = iYoffset;
}
// CREATE FORM LABELS
createTextField(tempContac
tLabelVar,
200+i, -70, iYoffset, 100, 60);
eval(tempContactLabelVar).
textColor = 0x000000;
eval(tempContactLabelVar).
text = contact[i][1];
iYoffset = eval(tempContactVar)._y+ev
al(tempCon
tactVar)._
height+10;
}
}
this.onLoad = function() {
//Set here your X value
addTextFields(contact.leng
th);
};
Start Free Trial