Using the <img> tags

Hi all!,

I’m trying to use the <img> tags to display a picture in my dynamically loaded text (from a .txt file) .

Here is the code I’m using to load my external text file:

on (release) {
loadText = new LoadVars();
loadText.load(“TEXT1.txt”);
loadText.onLoad = function(success) {
if (success) {
textBox.html = true;
textBox.htmlText = this.textContent;
}
};

}

Here is what is in my text file that I load:

<img src=‘image.jpg’>

The text that is also in my file loads and I can see that, the <img> tag code is invisible meaning it recognized it as code and did not display it as text. Even though the <img> text is gone it refuses to show my image. I have tried just about everything I know of and can’t get it to work.

Please help!

Thanx in advance

I am not sure about MX 2004 but in MX, the html reader in flash only accepts a few tags, and the others it refuses as you said. I don’t know how to fix it but you may be able to use the scrollpane component.

I know this isn’t much help, sorry.

Save the text file as an html file, then just load TEXT1.html.

The image has been probably saved as a progressive JPEG?

http://www.macromedia.com/support/flash/ts/documents/cant_load_jpg.htm

or is not in the same folder…
or is not even a jpg…
you never know :smiley:
in most cases, it’s the (stupid) progressive jpg!
I still don’t understand why Macromedia decided to go with jpg instead of png, as this is fireworks native format + supports transparency?!!

thanx everybody… but it’s still not working. In photoshop I made sure I saved it as a baseline jpg instead of a progressive. I also made sure it is in the same folder. Changing it to a html file didn’t work eather, although when you cliced on the actual html file the image showed up, but did not load in flash.

could it be a problem with saving in photoshop?

thanx again guys

post the fla, the text and one of the jpg’s

Ok, here’s a cut down version of the fla (removed a lot of graphics and other buttons). Also included is the jpg I’m trying to load, and the text file that loads the jpg.

Click here to download the zip

Ok, I got a little farther. When I make a basic scene with just a text box, and put the code to open my text file on the frame, it works just fine. When I add a button to execute the code instead of the frame, and run the fla file, and click on the button, the text loads, but the jpg does not.

Any suggestions?

Thanx in advance

I got it, just had to start over, fla must have been corrupt or something.

Thanx all for your help!

I know this is an old thread but was hoping I could resurrect it.

I’m having similar problems to the guys above, I can get the image to load into my text field if I have the action on a frame, but as soon as I call for the action from a button it wont work?

Does anyone have any bright ideas?

Any help would be great.

Cheers, J