3 Replies Latest reply on May 4, 2008 10:17 PM by _LJ

    Display HTML data

      Hi All,
      Currently i am developing a Flex 2/3 template that can display any given HTML data, for example, my template should be able to process file or tags, e.g. <html><head/><body><h1>Hello</h1></body></html> or as simple as <h1>Hello</h1>, and display as what Web browser does.

      I have search google and there is one given solution to use IFrame. However, IFrame can process a given URL but not pure HTML message or tags. I have tried textArea.htmlText but its not worked very well. So could anyone suggest me how to do it?

      And what about an advanced solution that supports Javascript and CSS?

        • 1. Re: Display HTML data
          jylaxx Level 1
          You have no choice : using iframe/div (I think there is a way to set data instead of url) in Flash Player or using AIR
          • 2. Re: Display HTML data
            slaingod Level 1
            Yes, people tend to think at first (myself included) that since Flash player is used in a web browser environment it should BE a web browser. But obviously Firefox or Internet Explorer or Safari are 10's of MB in size, whereas Flash player is 2mb download. Flash may get better at dealing with some basic HTML at some point, but CSS, etc. are almost certainly never going to be fully supported. Look at the existing compatibility issues between the major browsers already and ACID tests. Adding another one into the mix is counterproductive.

            I certainly agree, it is annoying when I get a 60k letter Terms & Conditions Word DOC from my client's legal department, that I then have to massage into htmlText for Flex.

            That said, you can pop and iframe or a div using javascript and ExternalInterface in many cases (assuming there are no security/domain issues). You should be able to pass the html to a javascript method that then simply inserts it into a div. If there are limitations on the amount of data that can be passed, you may need to make a few calls to build up a huge div (not sure if there is, just saying it is possible to concatentate if you run across some limitation).
            • 3. Re: Display HTML data
              _LJ Level 1
              Thanks for your answers. I know its kinda of tricky cause normally it is "Flex in HTML" but not "HTML in Flex". I will try iframe to externally interfacing web browser to complete my task.