Oli
06-13-2003, 03:20 PM
Hi,
Does anyone know a work around that will enable me to format text at a given 'beginIndex' and 'endIndex' using setNewTextFormat. I know this can be done using setTextFormat. I am using setNewTextFormat instead though because I'm loading the contents of a Flash movie from an XML file, and calling a function on various frames to populate a text box with specific text. the function is:
function doPopulate(arrayPosition, sectionNumber) {
var part1Node = section1PartsArray[sectionNumber];
var stepsArray = part1Node.childNodes;
var stepsNode = stepsArray[0];
var stepsPNode = stepsNode.childNodes;
var pgArray = stepsPNode[arrayPosition];
var pgNode = pgArray.childNodes;
mainTextFormat = new TextFormat("HelveticaNeue Condensed", 14, 0x324B72);
_root.section1Text_txt.setNewTextFormat(mainTextFo rmat);
_root.section1Text_txt.text = "";
for (i=0; i<=pgNode.length-1; i++) {
this["step"+i+"Array"] = pgNode[i];
this["step"+i+"Text"] = this["step"+i+"Array"].firstChild;
this["step"+i] = this["step"+i+"Text"].nodeValue;
_root.section1Text_txt.text += this["step"+i]+newline+newline;
}
}
What I need to be able to do is format titles differently from the main body of text. The contents of the XML will also be translated to a number of different languages so I need to keep this as dynamic as possible. So I attempted to access nodes with attributes = "bld"
formatting = pgNode[i].attributes.fmt;
cnv2String = pgNode[i].firstChild.nodeValue.toString();
stringLength = cnv2String.length;
if (formatting == "bld") .....etc
this works fine, but without being able to assign start and end index's to setNewTextFormat I'm stuck..:confused:
Does anyone have any suggestions
Does anyone know a work around that will enable me to format text at a given 'beginIndex' and 'endIndex' using setNewTextFormat. I know this can be done using setTextFormat. I am using setNewTextFormat instead though because I'm loading the contents of a Flash movie from an XML file, and calling a function on various frames to populate a text box with specific text. the function is:
function doPopulate(arrayPosition, sectionNumber) {
var part1Node = section1PartsArray[sectionNumber];
var stepsArray = part1Node.childNodes;
var stepsNode = stepsArray[0];
var stepsPNode = stepsNode.childNodes;
var pgArray = stepsPNode[arrayPosition];
var pgNode = pgArray.childNodes;
mainTextFormat = new TextFormat("HelveticaNeue Condensed", 14, 0x324B72);
_root.section1Text_txt.setNewTextFormat(mainTextFo rmat);
_root.section1Text_txt.text = "";
for (i=0; i<=pgNode.length-1; i++) {
this["step"+i+"Array"] = pgNode[i];
this["step"+i+"Text"] = this["step"+i+"Array"].firstChild;
this["step"+i] = this["step"+i+"Text"].nodeValue;
_root.section1Text_txt.text += this["step"+i]+newline+newline;
}
}
What I need to be able to do is format titles differently from the main body of text. The contents of the XML will also be translated to a number of different languages so I need to keep this as dynamic as possible. So I attempted to access nodes with attributes = "bld"
formatting = pgNode[i].attributes.fmt;
cnv2String = pgNode[i].firstChild.nodeValue.toString();
stringLength = cnv2String.length;
if (formatting == "bld") .....etc
this works fine, but without being able to assign start and end index's to setNewTextFormat I'm stuck..:confused:
Does anyone have any suggestions