Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 12-02-2005, 09:53 AM   #1
David Heath
Registered User
 
Join Date: Aug 2005
Posts: 42
Default Inserting Line Breaks In XML

Hi there,

I have an XML file linked to a Flash Movie, which picks up the relevant text from the XML and inserts it into one single static multiline text box within the movie. I would like to know how to insert a line break into the XML so that the text appears on a new line within the text box in the Flash movie.

Just putting the text on a new line within the XML causes two line breaks to appear in the Flash movie.

I'm wodering, therefore, if there is a line of code, or a tag I can use within the XML that let's Flash know to display the next piece of text on the next line.

Thanks for your help,

Dave
David Heath is offline   Reply With Quote
Old 12-02-2005, 10:21 AM   #2
FormerSwinger
CurrentFlasher
 
FormerSwinger's Avatar
 
Join Date: May 2005
Location: Finland
Posts: 382
Default

have you tried adding /n ?

If your textfield supports html you could try adding <br /> tags.
If you add tags it might be that the xml entry needs to be inside a cdata section or encoded with base64 encoding (free downloadable actionscrip class. Search "base64 actionscript" with google)?
FormerSwinger is offline   Reply With Quote
Old 12-02-2005, 10:31 AM   #3
David Heath
Registered User
 
Join Date: Aug 2005
Posts: 42
Default

Quote:
Originally Posted by FormerSwinger
have you tried adding /n ?
People have tried suggesting this to me before, but it's never worked!

Is there any reason it would or wouldn't work only in certain situations?
David Heath is offline   Reply With Quote
Old 12-02-2005, 10:39 AM   #4
David Heath
Registered User
 
Join Date: Aug 2005
Posts: 42
Default

Also; I really don't understand this CDATA thing.

It clearly isn't enough to just place:

<![CDATA[<br>]]>

Into the XML between the two lines I want to seperate...so how do I go about utilising it?

Is the CDATA tag purely managed in the XML or do I have to reference it in the ActionScript as well?
David Heath is offline   Reply With Quote
Old 12-02-2005, 11:33 AM   #5
FormerSwinger
CurrentFlasher
 
FormerSwinger's Avatar
 
Join Date: May 2005
Location: Finland
Posts: 382
Default

I meant that you'd put the whole text entry inside cdata. Not just the <br> if the <br> is not encoded or inside a cdata section the xml thinks it's not text but an xml tag.
FormerSwinger is offline   Reply With Quote
Old 12-02-2005, 11:40 AM   #6
FormerSwinger
CurrentFlasher
 
FormerSwinger's Avatar
 
Join Date: May 2005
Location: Finland
Posts: 382
Default

I'm currently storing image comments encoded with base64 inside an xml file and line breaks work like they should. The encoding also allows me to store html tags inside the xml without the xml structure getting all messed up. (it only took 10 minutes for me to find and implement the base64 stuff)

I've never actually used the cdata myself but it should work also.
FormerSwinger is offline   Reply With Quote
Old 12-02-2005, 12:20 PM   #7
David Heath
Registered User
 
Join Date: Aug 2005
Posts: 42
Default

Well, it doesn't give me an error anymore but it's actually printing the <br /> tags out within the Flash movie!

I have:

Code:
<p6 fmt="nml"><![CDATA[The following is necessary:<br/>- Message 1<br/>- Message 2<br/>- Message 3<br/>- Message 4]]></p6>
But it's actually printing in the movie:

Quote:
The following is necessary:<br/>- Message 1<br/>- Message 2<br/>- Message 3<br/>- Message 4]]></p6>
Am I still doing something wrong?
David Heath is offline   Reply With Quote
Old 12-04-2005, 08:54 AM   #8
acolyte
Senior Member
 
acolyte's Avatar
 
Join Date: Feb 2005
Posts: 532
Default

Quote:
Originally Posted by David Heath
Well, it doesn't give me an error anymore but it's actually printing the <br /> tags out within the Flash movie!

I have:

Code:
<p6 fmt="nml"><![CDATA[The following is necessary:<br/>- Message 1<br/>- Message 2<br/>- Message 3<br/>- Message 4]]></p6>
But it's actually printing in the movie:



Am I still doing something wrong?
Hello David dont wonder why <br/> isnt working

>>> <br> <<< this is the tag you should use ( without Frontslash )

btw i gathered this knowledge out of the Flash helpfile from macromedia

cheers m@
__________________
>>I know my english sucks, ... but I speak german.
(this Signature was stolen from some french guy)

Last edited by acolyte; 12-04-2005 at 08:57 AM.
acolyte is offline   Reply With Quote
Old 12-05-2005, 01:04 PM   #9
arkanoid2k
Registered User
 
Join Date: Sep 2004
Posts: 83
Default

if im not mistaken.. \n in XML = &#10...
try some research on this.
arkanoid2k is offline   Reply With Quote
Old 12-05-2005, 01:14 PM   #10
JEBoothjr
Registered User
 
JEBoothjr's Avatar
 
Join Date: Dec 2002
Location: Ohio
Posts: 408
Send a message via AIM to JEBoothjr
Default

How are you reference the node in you code? In order to access the node in this XML file:

Code:
<?xml version="1.0"?>
<node>
	<p6 fmt="nml"><![CDATA[The following is necessary:<br/>- Message 1<br/>- Message 2<br/>- Message 3<br/>- Message 4]]></p6>
</node>
You would use:

ActionScript Code:
myXML.firstChild.childNodes[0].childNodes[0].nodeValue;
JEBoothjr 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

Similar Threads
Thread Thread Starter Forum Replies Last Post
remove line breaks in xml marxseven ActionScript 1.0 (and below) 17 01-29-2010 01:45 PM
dynamic text question about line breaks Flash Gordon Simple Stuff (Newbies) 10 01-31-2009 02:29 PM
Adding Line Breaks and Paragraph Breaks in Dynamic Text - Best Method Birdsong ActionScript 1.0 (and below) 6 06-01-2004 08:53 AM
flash form & php & line breaks smrcek ActionScript 1.0 (and below) 1 12-16-2001 11:15 PM


All times are GMT. The time now is 01:22 AM.

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