tags:

views:

178

answers:

5

I want to display an image located in the app-storage directory of my AIR application. This image has to be displayed in an html text area where the html text is coming in from a local embedded sqlite database.

When I put in the following code:

imageTest.htmlText = '<img src="app-storage:/demo.jpg" border="0" />';

nothing is displayed.

But when instead of the app-storage path, I put in the absolute url of an image on the web, like below:

imageTest.htmlText = '<img src="http://www.example.com/demo.jpg" border="0" />';

the image is displayed correctly.

Also, I checked that the app-storage method is able to locate the image, but it just does not display in an htmlText container. For example, the following code displays the image:

imageTest.location = 'app-storage:/demo.jpg';

Any suggestions what I should do to get the image to display? I am using Adobe Flex Builder 3 as the IDE.

Thanks
Vinayak

A: 

Have you tried this?

imageTest.htmlText = '<img src="'+ File.applicationStorageDirectory.nativePath +'/demo.jpg" border="0" />';
Thomas
Hi Thomas, thanks. I tried this. The image is still not displayed. But now there is a question mark displayed where the image should be. This is how it looks - http://tinypic.com/r/2luxaf5/6 Also I tried tracing the path - it is giving the correct path to the image in the file system but for some reason the image is not appearing.
Vinayak
A: 

This is very strange! The following code works for displaying images when I use the open source Flex Builder SDK on the Eclipse IDE, but does not work when I use the Adobe FlexBuilder IDE:

imageTest.htmlText = '<img src="app-storage:/folder/demo.jpg" />';

Maybe it is a bug.

Vinayak
It's not a bug, your in the sandbox.
dalore
A: 

I have found exactly the same problem. It was working and then stopped working after I upgraded to Flex Builder 3.2.0

Did you report it as a bug?

Paul
not yet. have been lazy.
Vinayak
A: 

Have posted as a bug:

https://bugs.adobe.com/jira/browse/FB-25986

Paul
+3  A: 

Since your loading the html as a string it isn't in the application sandbox by default. Have you tried setting:

placeLoadStringContentInApplicationSandbox = true;

http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/html/HTMLLoader.html#placeLoadStringContentInApplicationSandbox

dalore
thanks. this worked.
Vinayak

related questions