I thought you guys would say that, so I started down that path.
But, it isn't going as smooth as I thought it would, can you point out the error in my ways?
Code:
function galleryNameSuccess(re:ResultEvent){
//set initial position for text
x = 110;
y = 220;
depth = 1000;
for(i = 0; i < re.result.length; i++){
//create uniqe fieldName
var fieldName:String = "txtField" + i;
var moveClipName:String = "movieField" + i;
var mc:MovieClip = createEmptyMovieClip(movieClipName, depth);
mc._x = x;
mc._y = y;
mc._height = 15;
//create new textfield
mc.createTextField(fieldName, depth + 1000, x, y, 50, 15);
//set the text attribute
mc[fieldName].text = re.result[i];
mc._width = mc[fieldName].textWdith;
//apply text format
if(re.result[i] == _parent.currentGallery){
mc[fieldName].setTextFormat(selectedFormat);
}
else{
mc[fieldName].setTextFormat(fmt);
}
//increase x for next time through
x += mc[fieldName].textWidth + 5;
//only allow 5 items on the first row.
depth++;
if(i == 4){
y += 15;
x = 117;
}
}
}
I don't get any errors when I run this, and if I put a trace of mc[fieldName].text, I get the expected values. However, none of the text displays.
Just for reference, this is the code that I had working, before I added the child movie clip:
Code:
function galleryNameSuccess(re:ResultEvent){
//set initial position for text
x = 110;
y = 220;
depth = 1000;
for(i = 0; i < re.result.length; i++){
//create uniqe fieldName
var fieldName:String = "txtField" + i;
//create new textfield
createTextField(fieldName, depth, x, y, 50, 25);
//set the text attribute
this[fieldName].text = re.result[i];
//debugging information
//trace(fieldName + ":" + this[fieldName].text + "," + x + "," + y);
//apply text format
if(re.result[i] == _parent.currentGallery){
this[fieldName].setTextFormat(selectedFormat);
}
else{
this[fieldName].setTextFormat(fmt);
}
//increase x for next time through
x += this[fieldName].textWidth + 5;
//only allow items on the first row.
depth++;
if(i == 4){
y += 15;
x = 117;
}
}
}
Anyone know why I am not getting text to display in the first chunk of code?