Ive linked a xml-document (just simple text) to a dynamic textfield.
The text displays, alright, but somehow the browser or the parser or whatever chooses to display extra break-lines.
Ive set the dynamic textfield to read html, so it will break when the actionscript outputs a "< br>", for instance.
Ive read about the XML.ignoreWhite, and drew the conclusion that this might have something to do with the problem. But when I try to put it in my code, the text wont show alltogether.
The actionscript:
----------------------------------------------------------------------
XML_var = new XML();
// now load up the url.
XML_var.load("xml/Studerande.xml");
// when xml is loaded call functon displayXML
XML_var.onLoad = displayXML;
function displayXML()
{
mainTag = new XML;
elementTag = new XML;
articleList = new Array;
elementList = new Array;
mainTag = this.firstChild.nextSibling;
articleList = mainTag.childNodes;
txt = "";
//loop through xml
for(i=0;i<=articleList.length;i++)
{//start for
elementList = articleList[i].childNodes;
//start for
for(j=0;j<=elementList.length;j++)
{//start for
elementTag = elementList[j];
head = elementTag.firstChild.nodeValue;
//Displays the first
if(elementTag.nodeName.toLowerCase() == "node_head")
{txt += head +"" "<br>";}
//Runs through and displays the rest of the nodes in xml-document
else {txt += head +"" + "<br>";}
}//end for
}//end for
}
--------------------------------------------------------------------------------
The result displayed:
---------------------------------------------------------------------------------
<first two blank lines - dont want them>
Studerande
<blank line - should only be new line>
Anna Pettersson 1
<blank line - should only be new line>
Lisa Nilsson
---------------------------------------------------------------------------------
The problem is not really clear. Your code seems to be too complex for the xml file. Unfortunately the tags don't show up. If you place the xml and fla files to download, I can have a look.
- The right of the People to create Flash movies shall not be infringed. -
i have the same problem.
but when you make tekst like this
Code:
textfield=<br>text text text</br><br>text text text</br><br>text text text</br><br>text text text</br><br>text text text</br><br>text text text</br><br>text text text</br><br>text text text</br><br>text text text</br><br>text text text</br><br>text text text</br><br>text text text</br>
with HTML line break code ( br and /br (with the < and > but they don't show when you see it on the board)).
then it works, but i just want to copy past my text when i update it.
i don't want to make the line break code for every line of text.
maybe this wil help you a bit.
grafx
ps. the ignoreWhite is for the xml file, if you made it like HTML looks then you will need it. if you wrote every thing in one line then you don't need it.
Tupps had recently published a way to put html tags into xml some weeks ago in this forum.
You can also get linebreaks etc, when you put your file as a childnode. Check http://can_info_guide.tripod.com/
special text files.
- The right of the People to create Flash movies shall not be infringed. -