• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 229
  • Last Modified:

HTML fomatting wrong in flash 8 dynamic text area

I am quite new to flash and am experimenting with version 8.  I have some actionscript which runs, but the result is not as expected.

The objective is to load a dynamic text area with HTML from code. It steps through a bunch of array items, putting the contents (in html) into the box. The first 2 display perfectly, then the 3rd is all screwed up with different fonts and list tags where there shouldn't be. It seems that if it displays a list in one message, then the next one will not format correctly. Also get the problem with bold as well. My code is below. I wondered if I have to clear something in the control before loading next html content in? Any help would be greatly appreciated. narrbox is the text area (there is another as well -titlebox which is ok):


var arrMsg=new Array()

arrMsg[1] = "<p><b>YYYY</b> is vital to xxxx because our organisation is <b>reliant</b> on Technology to support the business.</p>"
arrMsg[2] = "<p>YYYY will enable us to:<li>Make informed business risk management decisions</li><li>Support our Clients</li><li>Maintain Regulatory compliance</li><li>Achieve our business goals.</p>"
arrMsg[3] = "<p>We have:</p><li>Helped protect the Business</li><li>Avoided expenditures on non-material issues</li><li>Achieved successful cooperation with Business Owners</li><p>Cooperation with the YYYY Team ensured that:</p><li>The majority of high rated risks have been mitigated in a cost effective manner prior to entering the production environment.</li></p>"
arrMsg[4] = ""

this.createClassObject(mx.controls.UIScrollBar, "my_sb", 20);
function setUpSB() {
      my_sb.setSize(16, narrbox._height);
      my_sb.move(narrbox._x+narrbox._width, narrbox._y-5);
      my_sb.symbolDisabledColor = 0x000000;
      var flash_css = new TextField.StyleSheet();

      flash_css.onLoad = function(success:Boolean) {
            if (success) {
                  narrbox.styleSheet = flash_css;
                  titlebox.styleSheet = flash_css;
            } else {
                  trace("Could not load CSS file.");

var slide=0;
function setNarrator(sMsg, sTitle) {
      if (sMsg!=""){slide = slide + 12};
      progbar._width = slide;

      narrbox.text = arrMsg[sMsg];
      titlebox.text = '<p class="headline">'+sTitle+'</p>';
  • 3
  • 2
1 Solution
Wow, amazing how long that took to find! :)

You're just missing an </li> at the end of arrMsg[2]

<li>Achieve our business goals.</p>

should be

<li>Achieve our business goals.</li></p>

spanoutAuthor Commented:
Thanks Sam, I will try that, but when I load the next message, is the old stuff not cleared out?

Yes, it clears the box and replaces old with new.

But, I've never been able to explain the fact that errors carry over, like in your case.  The missing </li> is a formatting error, but I have no idea why that error carries over to the next one even though the old text is cleared out.

spanoutAuthor Commented:
Thanks Sam that worked... looks like it doesn't clear out the previous values properly, and the html support is really poor as well.
Yes, html support is really poor in Flash.  I don't use Flash 8 yet, but I'm surprised they haven't done more about that yet.  Of course, html isn't really the scope of the application, so any html support at all is just an added bonus! :)

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now