• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Code Fix!

// Create a new style sheet object
var style_sheet = new TextField.StyleSheet();

var storyText:String = "<span class='headline'>Monster Robots Run
  Amok!</span><br>";
storyText += "<p><span class='location'>San Francisco, CA—</span>";
storyText += "Lorem ipsum.</p>"

news_txt.multiline = true;
news_txt.wordWrap = true;
// true or false, the "html" property doesn't matter here.
//news_txt.html = true;
// Load CSS file and define onLoad handler:
style_sheet.load("html_styles.css");
style_sheet.onLoad = function(ok)
{
  if (ok)
  {
    // If the style sheet loaded without error,
    // then assign it to the text object,
    // and assign the HTML text to the text field.
    news_txt.styleSheet = style_sheet;
    news_txt.text = storyText;
  }
};


					  

The style information (html_styles.css) follows:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint