hello,every friend here, I’ve got bit stuck of the following code, I don’t know why the txt doen’t display in flash movie, I guess it’s a simple error but I just don’t find it.
orginal source can be find here:
http://www.ventdaval.com/foros/justifiedText.as
http://www.ventdaval.com/foros/justifiedText.html
the modified code goes here:
[FONT=Courier New]
function createJustifiedText(name, depth, x, y, width, text, format) {
this.createEmptyMovieClip(name, depth);
this[name].createTextField("tempCamp", 10, 0, 0, 0, 0);
this[name].tempCamp.setNewTextFormat(format);
this[name].tempCamp.text = "lala";
this[name].tempCamp.autoSize = true;
this[name].tempCamp.embedFonts = true;
var iniY = this[name].tempCamp._height;
this[name].tempCamp.text += newline+"lala";
var finY = this[name].tempCamp._height-iniY;
this[name].tempCamp.removeTextField();
var posX = 0;
var posY = 0;
var j = 0;
var l = 0;
var promedio = 0;
this[name]._x = x;
this[name]._y = y;
var aSaltos = text.split(String.fromCharCode(13));
for (var ij = 0; ij<aSaltos.length; ij++) {
var aTexto = aSaltos[ij].split(" ");
for (var i = 0; i<aTexto.length; i++) {
l++;
this[name].createTextField("campo"+l, l, posX, posY, 0, 0);
this[name]["campo"+l].setNewTextFormat(format);
this[name]["campo"+l].text = aTexto*;
this[name]["campo"+l].autosize = true;
this[name]["campo"+l].embedfonts = true;
this[name]["campo"+l].selectable = false;
posx += this[name]["campo"+l]._width;
aLinea[j] = "campo"+l;
j++;
if (posX>width) {
posY += finY;
posx -= this[name]["campo"+l]._width;
this[name]["campo"+l].removeTextField();
i--;
promedio = (width-posX)/(j-2);
for (k=1; k<aLinea.length; k++) {
this[name][aLinea[k]]._x += promedio*k;
}
aLinea = new Array();
j = 0;
posX = 0;
}
}
j=0;
posX=0;
posY+=finY;
}
}
var myformat:TextFormat = new TextFormat();
myformat.font="verdana";
myformat.size=12;
var txt:String = "abc";
createJustifiedText("test",1, 10, 10, 20,txt,myformat);
[/FONT]
for importantce, I modified this first post. sorry senocular and thanks for your help.