Hellos
If any kind soul can, pls help me with this, it would be great: I added an empty movie clip called mc to _level0 at runtime. Then within this for loop I dynamically added textfields. This part works fine.
Problem: When I click through the textfields, sometimes the text just disappears. I’ve tried doing a trace, and the actual values are in the text field, they just aren’t visible. I’ve seen a lot of posts with similar problems around the net, but not quite sure what solves the problem. Am I missing something obvious?
for (i = 1; i <= total_photos ; i++)
{
//create text boxes
s = "p" + i;
var sTime = eval("myEvents.time" + i)
dStDate = getStartDate(iMode);
dEndDate = getEndDate(iMode);
dShowDate = getShowDate(sTime);
if (dStDate <= dShowDate && dShowDate <= dEndDate){
j = j + 1;
if (j==1){
txtName.text = eval("myEvents.caption" + i);
txtDescr.text = eval("myEvents.descr" + i);
txtTime.text = eval("myEvents.time" + i);
imgMC.loadMovie(folderName + s + ".gif");
}
yPos = 20 * (j-1) + 10;
_level0.mc.createTextField(s, 20 + i, 5, yPos, 240, 16);
_level0.mc[s].type = "dynamic";
_level0.mc[s].selectable = true;
_level0.mc[s].multiline = true;
_level0.mc[s].embedFonts = true;
_level0.mc[s].antiAliasType = "advanced";
_level0.mc[s].textColor = 0x7D7171;
_level0.mc[s].text = eval("myEvents.caption" + i);
if ((j & 1) == 0){
_level0.mc[s].background = true;
_level0.mc[s].backgroundColor = 0xE0DCDC;
}
else{
_level0.mc[s].background = false;
}
_level0.mc[s].setTextFormat(text_fmt);
_level0.mc[s].setNewTextFormat(text_fmt);
_level0.mc[s].onSetFocus = function()
{
sName = this._name;
iLen = sName.length;
iNum = sName.substr(1, iLen-1);
txtName.text = eval("myEvents.caption" + iNum);
txtDescr.text = eval("myEvents.descr" + iNum);
txtTime.text = eval("myEvents.time" + iNum);
current_photo = folderName + sName + ".gif";
imgMC.loadMovie(current_photo);
imgMC._x = 220 + (320 - imgMC._width)/2;
this.background = true;
this.backgroundColor = 0xffffff;
}
_level0.mc[s].onRelease = function()
{
stext = this.text;
this.text = stext;
}
_level0.mc[s].onKillFocus = function()
{
sName = this._name;
iNum = sName.substr(1, sName.length-1);
if ((iNum & 1) == 0){
this.background = true;
this.backgroundColor = 0xE0DCDC;
}
else{
this.background = false;
}
}
}
}
_level0.mc._height = (j+1) * 20;
};