0
TextField and CSS: How to control spacing between paragraphs
Community Beginner
,
/t5/animate-discussions/textfield-and-css-how-to-control-spacing-between-paragraphs/td-p/885381
Dec 18, 2008
Dec 18, 2008
Copy link to clipboard
Copied
I'm using an external CSS to format a textField that has some
HTML text in it, let's say something similar to this:
myTextField.htmlText = "<p>paragraph one</p><p>paragraph two</p>";
How can I control the spacing between paragraphs when there is no support for margin-top or margin-bottom? I don't want to add empty <p> or <br /> elements to my text since they don't allow exact control and insert too much space. Is there any good solution?
Thanks
myTextField.htmlText = "<p>paragraph one</p><p>paragraph two</p>";
How can I control the spacing between paragraphs when there is no support for margin-top or margin-bottom? I don't want to add empty <p> or <br /> elements to my text since they don't allow exact control and insert too much space. Is there any good solution?
Thanks
TOPICS
ActionScript
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/animate-discussions/textfield-and-css-how-to-control-spacing-between-paragraphs/m-p/885382#M21749
Dec 21, 2008
Dec 21, 2008
Copy link to clipboard
Copied
I hope someone will have a different answer but I am afraid
that it is not possible with HTML text to control line spacing.
Perhaps, one of the ways can be still using extra <p> tag and manipulate it's height with smaller font size so that it doesn't take as much space as it will by default. Say, you can have a declaration in CSS:
.spacer {
font-size = 4px;
}
and in the text field:
<p class="spacer"></p>
Again, I would love to see a better solution.
Perhaps, one of the ways can be still using extra <p> tag and manipulate it's height with smaller font size so that it doesn't take as much space as it will by default. Say, you can have a declaration in CSS:
.spacer {
font-size = 4px;
}
and in the text field:
<p class="spacer"></p>
Again, I would love to see a better solution.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
smohadjer
AUTHOR
Community Beginner
,
/t5/animate-discussions/textfield-and-css-how-to-control-spacing-between-paragraphs/m-p/885383#M21750
Dec 22, 2008
Dec 22, 2008
Copy link to clipboard
Copied
But my textField reads the text from an XML file which
doesn't have any empty <p> tags and I don't have control over
the content of XML.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/animate-discussions/textfield-and-css-how-to-control-spacing-between-paragraphs/m-p/885384#M21751
Dec 22, 2008
Dec 22, 2008
Copy link to clipboard
Copied
Are the <p> tags part of XML? You did not mention it in
the first post.
What is the XML structure?
What is the XML structure?
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
/t5/animate-discussions/textfield-and-css-how-to-control-spacing-between-paragraphs/m-p/885385#M21752
Dec 22, 2008
Dec 22, 2008
Copy link to clipboard
Copied
This can be kind of fussy but it can work if the text field
doesn't auto size. I make a style where the leading is larger then
the leading of the paragraph then span it inside what would be the
last line (so there's really only one paragraph):
.halfp {
leading: 17;
}
<p>The paragraph text starts. The last line starts here<span class="halfp">and ends here.</span>The second paragraph starts here and continues...</p
.halfp {
leading: 17;
}
<p>The paragraph text starts. The last line starts here<span class="halfp">and ends here.</span>The second paragraph starts here and continues...</p
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
smohadjer
AUTHOR
Community Beginner
,
/t5/animate-discussions/textfield-and-css-how-to-control-spacing-between-paragraphs/m-p/885386#M21753
Dec 22, 2008
Dec 22, 2008
Copy link to clipboard
Copied
Thanks but such solutions are worse than the problem. You are
again assuming that I have control over the XML file. The reason I
have put the content of the textField in XML is that my client can
update the content of the Website without my help.
Is supporting "margin-bottom" in CSS such a big endeavour for Adobe team? Why do they boast supporting CSS when we can't even use a rule as basic as that? I'm also supprised that CSS support in Flash/ActionScript has not improved a bit since four years ago. The list of CSS properties in Flash CS3 looks the same as those in Flash MX 2004!
Is supporting "margin-bottom" in CSS such a big endeavour for Adobe team? Why do they boast supporting CSS when we can't even use a rule as basic as that? I'm also supprised that CSS support in Flash/ActionScript has not improved a bit since four years ago. The list of CSS properties in Flash CS3 looks the same as those in Flash MX 2004!
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
smohadjer
AUTHOR
Community Beginner
,
/t5/animate-discussions/textfield-and-css-how-to-control-spacing-between-paragraphs/m-p/885387#M21754
Dec 22, 2008
Dec 22, 2008
Copy link to clipboard
Copied
The structure of XML is like this:
<page>
<h1>here is the title</h1>
<p>here comes 1st paragraph...</p>
<p>here comes another paragraph...</p>
...
<p>here is the last paragraph...</p>
</page>
<page>
<h1>here is the title</h1>
<p>here comes 1st paragraph...</p>
<p>here comes another paragraph...</p>
...
<p>here is the last paragraph...</p>
</page>
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
/t5/animate-discussions/textfield-and-css-how-to-control-spacing-between-paragraphs/m-p/885388#M21755
Dec 22, 2008
Dec 22, 2008
Copy link to clipboard
Copied
You might be able to add a style to increase the leading of
the last line after you loaded the XML via search and replace. So
search for </p> and change it to </span></p then
back up x number of characters to get to the line above and add
<span class="halfp">
<p>The paragraph text starts. The second to last line starts here and ends <span class="halfp"> here.The last line starts here and ends</span></p
<p>The paragraph text starts. The second to last line starts here and ends <span class="halfp"> here.The last line starts here and ends</span></p
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/animate-discussions/textfield-and-css-how-to-control-spacing-between-paragraphs/m-p/885389#M21756
Dec 23, 2008
Dec 23, 2008
Copy link to clipboard
Copied
I think rob day's suggestion has merits too. Either way I
don't see any other way but inserting an extra element that adjusts
the spacing somehow.
Yes, it sucks that the majority of styling declarations are not supported but, on the other hand, it is not such a big deal to insert an element especially with the powerful XML tools in AS3.
You can create a function that will preprocess all XML "page" nodes and insert an extra <p> tag after each <p> tag (see attached code)
I did not check if code works - it is just a concept.
The same approach can be taken with rob's suggestion but inside the <p> element that comes with the XML.
Yes, it sucks that the majority of styling declarations are not supported but, on the other hand, it is not such a big deal to insert an element especially with the powerful XML tools in AS3.
You can create a function that will preprocess all XML "page" nodes and insert an extra <p> tag after each <p> tag (see attached code)
I did not check if code works - it is just a concept.
The same approach can be taken with rob's suggestion but inside the <p> element that comes with the XML.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
/t5/animate-discussions/textfield-and-css-how-to-control-spacing-between-paragraphs/m-p/885390#M21757
Dec 23, 2008
Dec 23, 2008
Copy link to clipboard
Copied
Andrei, I don't think adding a new paragraph will work
because negative leading has no effect, so a new paragraph would
only add more space. My trick changes the leading of the last line
of the paragraph, so if the p tag leading is 12 then the .halfp
class with a leading of 18 would give the look of a half space.
What makes it tricky is the opening of the span tag has to be in
the next to last line of the paragraph and it has to be closed in
the last line. That's why I was suggesting a reg expression search
and replace.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
LATEST
/t5/animate-discussions/textfield-and-css-how-to-control-spacing-between-paragraphs/m-p/885391#M21758
Dec 23, 2008
Dec 23, 2008
Copy link to clipboard
Copied
Rob,
You are absolutely right about inserting <p> tag. Your suggestion looks much better.
<span> can be inserted easily with either, as you said, RegEx or with XML methods.
You are absolutely right about inserting <p> tag. Your suggestion looks much better.
<span> can be inserted easily with either, as you said, RegEx or with XML methods.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

