views:

387

answers:

2

I have the following HTML component, trying to display a local image, however it will not show up whether I use <img src="file:/tmp/img.png"> or <img src="/tmp/img.png" />. Any ideas why this doesn't work? Saving the file to a local file and opening it works fine!

var xhtml:XML = <html>
<body>
  <img src="file:/tmp/logo.gif" />
</body>
</html>;
myhtml.htmlText = xhtml.toXMLString();

Update:

This works fine, btw, if I save the same xhtml to a file and use webkit to open that file using myhtml.htmlLoader.load(new URLRequest("file:///path/to/html/file")).

A: 

Did you check for any javascript error in other parts of you webpage? They might be preventing your webpage to open.

Syntax looks OK for embedding image, check it here: http://www.w3schools.com/htmL/tryit.asp?filename=tryhtml_images2

shuby_rocks
A: 

Did you check for security sandbox violation? Also did you try with "tmp/img.png" and "./tmp/img.png"?

Or maybe Air doesn't support xhtml, I'm not sure. Try and remove the slash in the img tag like this:

myhtml.htmlText = "<html><body><img src=\"tmp/logo.gif\"></body></html>";
Lillemanden