PDA

View Full Version : HTML page in Flash: <IMG> tag doesn't work?


Meesha74
12-27-2010, 01:36 PM
I am really, really new to actionscripts but I am trying the following:

I want to embed a simple HTML page into a flash project. So I use a dynamic textfield with an action script that embeds the html page. All the text of the HTML page is visible, but the image that is in the HTML page is not.

This is the action script code that I use in Flash:

var LoadVarsText = new LoadVars();LoadVarsText.load("tekst.html");
LoadVarsText.onLoad = function(success) { if (success){ trace ("done loading");
scroller.html = true;scroller.htmlText = this.var1; }else{ trace ("not loaded"); } }

This is the HTML page (named: tekst.html)

var1=
<html>
This is the text for the textfield<BR>


<IMG SRC="google.jpg">
</HTML>

The google.jpg file is in the same directory as the flash movie, as is the HTML file. When I open the HTML file in my browser the image is visible. As I understand flash is able to recognize simple HTML tags, including the <IMG> tag. What am I doing wrong?

tg
12-28-2010, 03:55 PM
could it be a path problem to your image? in other words, is the path 'google.jpg' relative to the location of your HTML document the swf is embedded in?

xxneon
12-28-2010, 05:50 PM
it could be that you don't have the image tag terminated properly..

<IMG SRC="google.jpg">

vs.

<IMG SRC="google.jpg" />

also make sure that your textfield is high enough (or have autoSize set to true) to show all the content and is set for multiline.