HTML fomatting wrong in flash 8 dynamic text area

Posted on 2006-03-21
Last Modified: 2010-04-03
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>';
Question by:spanout
    LVL 16

    Accepted 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>


    Author Comment

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

    Expert Comment


    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.


    Author Comment

    Thanks Sam that worked... looks like it doesn't clear out the previous values properly, and the html support is really poor as well.
    LVL 16

    Expert Comment

    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! :)


    Featured Post

    Training Course: Adobe Photoshop CC 2015

    Photoshop has become the standard in image manipulation among professional photographers and graphic designers. This course covers exam objectives for the Adobe Certified Associate (ACA) certification.

    Join & Write a Comment

    I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
    I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
    The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
    The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now