Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 900533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:24:11+00:00 2026-05-15T15:24:11+00:00

Is there a way to control the vertical space between two HTML paragraphs, in

  • 0

Is there a way to control the vertical space between two HTML paragraphs, in an AS3 TextField?

I understand and have successfully applied CSS styles via AS3 and have also utilized the TextFormat class.

I am still unable to control the vertical space between a closing and an opening <p> tag:

txt.htmlText = "<p>First paragraph here.</p><p>Second paragraph here.</p>";

The example above renders with the correct font and letter-spacing, but the space between paragraphs is either two-times too tall if txt.condenseWhite = false or it is too condensed if txt.condenseWhite = true.

Since only margin-left and margin-right are available CSS attributes in AS3, and not margin-top or margin-bottom, I am at a loss.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T15:24:12+00:00Added an answer on May 15, 2026 at 3:24 pm

    I was able to get it to work by creating a new TextField instance for each HTML paragraph.

    Here is an abbreviated example:

    //Set the default spacing (leading) between paragraphs
    const PARAGRAPH_LEADING:int = 10;
    
    //Create first TextField instance
    var t:TextField = new TextField();
    addChild(t);
    t.x = 0;
    t.y = 0;
    t.multiline = true;
    t.wordWrap = true;
    t.width = 300;
    t.autoSize = TextFieldAutoSize.LEFT;
    t.border = true; //Just for the example
    t.condenseWhite = true;
    t.htmlText = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis a odio sed odio dignissim tincidunt vel in nisi. Aenean eu sem mauris, ac scelerisque eros. In hac habitasse platea dictumst. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Pellentesque rutrum porttitor eros sed vulputate. Sed mollis eros quis augue hendrerit lobortis. Quisque velit neque, placerat id tincidunt id, venenatis id felis. Ut in dolor eros.";
    
    //Create second TextField instance
    var t2:TextField = new TextField();
    addChild(t2);
    t2.x = 0;
    t2.y = t.y + t.height + PARAGRAPH_LEADING; 
    t2.multiline = true;
    t2.wordWrap = true;
    t2.width = 300;
    t2.autoSize = TextFieldAutoSize.LEFT;
    t2.border = true; //Just for the example
    t.condenseWhite = true;
    t2.htmlText = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis a odio sed odio dignissim tincidunt vel in nisi. Aenean eu sem mauris, ac scelerisque eros. In hac habitasse platea dictumst. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Pellentesque rutrum porttitor eros sed vulputate. Sed mollis eros quis augue hendrerit lobortis. Quisque velit neque, placerat id tincidunt id, venenatis id felis. Ut in dolor eros.";
    

    I also added a TextFormat instance that controls letterspacing (TextFormat.letterSpacing).

    And, to control the overall leading, I had to implement the solution listed here, where a <textformat> tag is appended to the string which will be displayed as htmlText in the TextField.

    Example:

    var str: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis a odio sed odio dignissim tincidunt vel in nisi.";
    str = '<textformat leading="2">' + str + '</textformat>';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to control where Resharper puts its backing fields? currently it
Is there a way to control the number of displayed rows in a DropDownList
In Java, is there a way to control the TTL of the IP header
Is there a way I can control columns from code. I had a drop
Is there any way to force a listview control to treat all clicks as
Is there any way to dock a Silverlight control to the browser window? For
Is there a way to cast a user control as a specific user control
Is there a way to reuse a 3rd party control reference? For example, I
Is there a way to check if a ValidationSummary control has its IsValid property
Is there a way to hide radio buttons inside a RadioButtonList control programmatically?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.