4 Replies Latest reply on Feb 16, 2007 10:45 AM by richardbrenkley

    Import HTML to text area/component

    Keith Dodd
      Am working on my first *real* Flex app. Am using tab navigator. On first tab and getting an xml doc from Resources folder, using HTTPService, and then the new e4x to display info.

      On another tab, I just want to display a static page that is mainly an html segment. (My client will be able to modify this html segment via ColdFusion, so works best to use a Flex method that "reads" my html file.

      Am stuck at how to get the html file and display it. This seems like it should be very simple! But, I can't figure it out. I'm trying the same HTTPService to get the html file.

      Appreciate any help/direction. Haven't seen anything quite like this in samples or tutorials...maybe because it's too basic.

      Thanks
      Keith
        • 1. Re: Import HTML to text area/component
          leotemp Level 1
          Flex's html capabilities are very limited, basically text formating and limited http interaction. When you say you want to display a static html segment do you mean you want to display a bit of html code within you flex app? if so this probably wont go unless your html is very limited and displayed within "HTMLtext"

          • 2. Re: Import HTML to text area/component
            Keith Dodd Level 1
            Thanks for quick reply!
            Yes, want display the html segment (probably in textfield), perhaps on a panel or just canvas.
            My small segment listed below.

            How do I get the file into the flex component? httpservice? Or some other method.

            Thanks!

            ----
            <h3>Our Photographer</h3>
            Our studios are located in Maryland and experiences the four seasons that the
            Mid-Atlantic Region offers.<br />
            Although each season brings special challanges for photography, together they
            provide the scope of beauty nature offers.
            <img src="Ellencamera.jpg" alt="Ellen" width="200" height="183" border="1" align="top" />
            • 3. Re: Import HTML to text area/component
              leotemp Level 1
              is there any reason you dont just use say xml data and build these in your flex application using flex componnents? I spent alot of time trying to bring the old html driven world i worked with into flex but it isnt needed, even if your static documents already exist or are part of an established production pipeline it would be better to build a script to parse those html docs into usable xml then try to import static html into your flex app.

              As far as a direct answer, here is a snippet from the docs under "HTMLtext" it basically shows you how to display limited html functionality within a text componnent:

              <mx:Text width="100%" color="blue" fontStyle="italic" fontSize="14">
              <mx:htmlText>
              <![CDATA[This is 14 point blue italic text.<br><b><font color="#000000" size="10">This text is 10 point black, italic, and bold.</font></b>]]>
              </mx:htmlText>
              </mx:Text>
              • 4. Re: Import HTML to text area/component
                richardbrenkley
                displaying html text that is directkly coded into the htmlText control is ok, but how do you display DYNAMIC html text within the <![CDATA[]]>

                ????