3 Replies Latest reply on Jan 10, 2007 7:37 AM by Jesus.Barba

    Error displaying IMAGES and TEXT

    Jesus.Barba
      Hello All,

      I am currently evaluating FLEX technology for my company future WEB developments. As part of the evaluation, I am working on a Web Page Demo.

      Currently I am stuck trying to show formated text with images. To do so I am using the the mx:htmlText property of the class mx:TextArea as it allows me to insert directly HTML code. I was aware that not all the tags were supported by the mx:htmlText property, but I was worried when I read this quote in the Flex Developers Guide "The <img> tag is not fully supported in Flex 2, and might not work in some cases.". Even this warning I decided to go head with the testing I set the <img src="image1.jpg"> inside the mx:htmlText. Unfortunately my suspects were confirmed: it did not work, I get this runtime error message twice each time I load the component with the HTML content "Error #2044: Unhandled IOErrorEvent:. text=Error #2036: Load Never Completed." I tried to use an absolute path and I got a security error but the image was displayed, but no relatives path are admited.

      CODE:

      <mx:TextArea xmlns:mx=" http://www.adobe.com/2006/mxml" width="100%" height="100%" editable="false" wordWrap="true" paddingRight="0" paddingLeft="0" backgroundImage="@Embed('recursos/logoINSITMA.jpg')">

      <mx:htmlText>
      <![CDATA[
      <p align="justify"><font size="13" color="#0021CC"><textformat leftmargin="5" rightmargin="5" leading="5">blah blah blah blah blah blah blah blah blah blah blah blah blah <img src='\logoinsitgris.GIF'> blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
      </textformat></font></p>
      ]]>
      </mx:htmlText>


      </mx:TextArea>


      As a walkaround I have thought to use mx:Labels and apply some styles to format text and mx:Images to add the pictures, but I am not pretty sure If I could generate same the layout I have in mind (I would like text surround the images).

      so my questions are:

      1-. Is my <img> syntax incorrect or there is something I should have in mind to avoid the error "Error #2044: Unhandled IOErrorEvent:. text=Error #2036: Load Never Completed"? Or this error is happening due this HTML tag is not supported by FLEX?

      2-. Does it exist any walkaround to generated formated text and images? Using mx:Labels and mx:Images could be, but they are much more restricted than HTML and in addition it is not very maintenable.

      All your comments/Ideas/suggestions are very welcome.

      Thanks in advance for you very valuable help.

      J.B.
        • 1. Re: Error displaying IMAGES and TEXT
          Jesus.Barba Level 1
          Hello Again,

          I just add the following <img src="com\foo\web\recursos\fotos\3GMovil.JPG" /> and the compiler directive -use-network=false and the issue is solved. If this directive is not used the following error is shown:

          SecurityError: Error #2148: SWF file file://D:\Trabajo\Web\Insit\0.7\paginas\loader.swf cannot access local resource file://D:\Trabajo\Web\foo\0.7\paginas\com\foot\web\recursos\fotos\3GMovil.JPG. Only local-with-filesystem and trusted local SWF files may access local resources.


          In case I use this directive the SWF generated will not be able to access the network.

          To avoid the errors related with the usage of my local workspace I have accessed pictures located on a server and I got the following:


          SecurityError: Error #2122: Security sandbox violation: BitmapData.draw: file://D:\Trabajo\Web\foo\0.7\paginas\loader.swf cannot access http://192.168.0.128:8080/VYMOWebPruebas/a.JPG. A policy file is required, but the checkPolicyFile flag was not set when this media was loaded.


          Please help! Is it possible to embed a picture in a SWF and then call then from the htmlText? Any of you have faced this issue?

          thanks in advance,

          JB
          • 2. Re: Error displaying IMAGES and TEXT
            Jesus.Barba Level 1
            Hello Again,

            I have resolved error 2122 by creating a policy file (crossdomain.xml )and locating it on the remote sever so I have a partial solution for my problem. Any way I would like to the get images loaded from the SWF directory.

            JB
            • 3. Re: Error displaying IMAGES and TEXT
              Jesus.Barba Level 1
              Solved. Set the security sand box as File system sand box.