Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

html formatting question

Status
Not open for further replies.

ColdFusionKing

Programmer
Dec 5, 2002
145
0
0
GB
Hi all, I have a dynamic textfield in a movie clip. The flash movie loads a text file and displays the contents of a html file in a dynamic text field. In the html file (the file containing the content), I have a number of <br> tags

&article_content1=Some sample text <br> Some more sample test&
&article_content2=Article 2 sample text <br> This is a news article&
&no_of_feeds=2&

When I publish the flash, I see <br>'s displayed on my page, How do I get round this problem? If I remove the <br> tags and use the enter key, I see an additional line break. This is how the above text is displayed

1)
Some sample text
<!-- I don't want this additional line break -->
Some more sample test

2)
Article 2 sample text

This is a news article

I want to display it like this

1)
Some sample text
Some more sample test

2)
Article 2 sample text
This is a news article

If I enable html rendering the problem is solved, but by doing this the Italics text effect is lost.

Can you think of something?
 
did you try this with html enabled
Code:
&article_content1=<i>Some sample text</i> <br> Some more sample test&
&article_content2=<i>Article 2 sample text</i> <br> This is a news article&
&no_of_feeds=2&
 
yes, and this does the trick, but because the content will be entered by a publisher with no knowledge of html, I can't go with this option. Is there a way to programatically say that replace the <br> character with a new line character?
 
What are you saying? The publisher can insert a <br> tag but not a <i> tag?

Regards,

cubalibre2.gif
 
sorry my bad! I don't want any html formatting in my html file. If the publisher enters some text, then hits the enter key (return key), the text gets displayed like this.

Article 2 sample text

This is a news article

(Notice the extra line break)
Whereas I want it to be displayed like this:

Article 2 sample text
This is a news article

I can get it to display it like that if I enable &quot;Rendering text as html&quot;, but if I enable that, I loose the font Italic style even when the italic style toogle is checked in the dynamic text field properties editor. Can you suggest something?
 
just let the client enter the text as they like then strip out the hard line breaks and replace with <br>

lv = new LoadVars()
lv.onLoad = function(){
my.htmlText = lv.content.split('\r\n').join('<br>');
}
lv.load(&quot;some.txt&quot;)
 
unfortunately I can't upload my fla to any repository. I can email it to you if you give me your email address. I have not made many changes to the fla which you have access to, I have removed the date_clip layers, title_clip layers, article_link layers and Important_clip layers, have also commented the action script. This is the present code I'm using

// set the variables loaded from CF into their respective locations
//date_clip.article_date = eval(&quot;article_date&quot;+count);
//title_clip.article_title = eval(&quot;article_title&quot;+count);

article_clip.article_content = eval&quot;article_content&quot;+count);
//article_link = eval(&quot;article_link&quot;+count);
//Important_clip.article_important = eval(&quot;article_important&quot;+count);
// if the counter reaches the max number of articles then reset it
// if not then increment it
if (count == no_of_feeds) {
count = 1;
} else {
count = count+1;
}

Bill, I am reading the contents from a html file and not a text file using the loadVariables function
loadVariables(&quot;supportFeed.html&quot;, &quot;content&quot;)

&quot;Content&quot; is the name of the movie clip. In there I have some action script.

On Frame 1:
// initialize the counter
count = 1;
stop();

On Frame 2:

article_clip.article_content = eval&quot;article_content&quot;+count);

// if the counter reaches the max number of articles then reset it
// if not then increment it
if (count == no_of_feeds) {
count = 1;
} else {
count = count+1;
}

There is a movie clip within this mc called &quot;article_clip&quot; which has the dynamic text field &quot;article_content&quot;.
 
oldnewbie, I've emailed you the fla and html file you asked for to your hotmail a/c.

Cheers
Allan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top