Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Supporting Technologies > Server-Side Scripting

Reply
 
Thread Tools Rate Thread Display Modes
Old 06-13-2003, 03:20 PM   #1
Oli
Registered User
 
Join Date: Jan 2003
Posts: 11
Question formatting XML using setNewTextFormat

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..

Does anyone have any suggestions
Oli is offline   Reply With Quote
Old 06-13-2003, 04:14 PM   #2
freddycodes
Master of Nothing
 
Join Date: Dec 2002
Location: San Diego, CA
Posts: 2,468
Default

Why do you have to use setNewTextFormat, you can just use setTextFormat, then you can pass the startIndex and endIndex args.

Or am I missing something, one thing to keep in mind with setTextFormat, you have to assign the text to the textfield before setting the textFormat.
freddycodes is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:12 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.