all groups > flash actionscript > april 2004 >
You're in the

flash actionscript

group:

html and images in flash


html and images in flash herod2221
4/16/2004 10:22:48 PM
flash actionscript:
hi-
i have a dynamic text box loading text from a text file. i've selected the
button in the text box properties that allows the text file to load as html.
the only problem is that it doesn't load images.

is there a way to get the html w/in flash to load images?
you can see my site now, and how the text loads. it's kind of boring w/o
images though. [L=website - UTSolarD]http://www.utsolar.org[/L]

thanks,
kenny
Re: html and images in flash herod2221
4/16/2004 10:40:17 PM
Re: html and images in flash herod2221
4/16/2004 11:55:47 PM
Re: html and images in flash Laiverd.COM
4/17/2004 12:29:23 AM
What version of Flash and what is the code you use? Also check that the
image is a non-progressive JPG file.

John

--
----------------------------------------------------------------------------
-----------
RESOURCES
http://groups.google.com/advanced_group_search?hl=en&as_ugroup=*flash
----------------------------------------------------------------------------
-----------
TUTORIALS at
www.laiverd.com
Flash & PHP Emailform
Using textfiles in Flash
----------------------------------------------------------------------------
-----------

Re: html and images in flash Laiverd.COM
4/17/2004 12:48:57 AM
Gif won't work.

John

--
----------------------------------------------------------------------------
-----------
RESOURCES
http://groups.google.com/advanced_group_search?hl=en&as_ugroup=*flash
----------------------------------------------------------------------------
-----------
TUTORIALS at
www.laiverd.com
Flash & PHP Emailform
Using textfiles in Flash
----------------------------------------------------------------------------
-----------

Re: html and images in flash kglad
4/17/2004 2:04:54 AM
the pic shouldn't be in the library and can be in any folder accessible to your
swf file. you just need to use the correct absolute or relative path to the
pic. for example, if you texfield has instance name tbox use:

tbox.htmlText = "<img src='jag1.jpg'>";

to load jag1.jpg from the same directory as your swf file. note you need to
use tbox.htmlText not tbox.text. also, make sure your textfield is multiline.
Re: html and images in flash herod2221
4/17/2004 3:42:49 AM
i may need to backstep a moment:
all that i've been doing was creating a dynamic text box, w/ multiline and
html tags selected, fill in the variable w/ the first word in my txt file (say
variable=text31, the first words in the .txt file are text31= ), and put a load
variable in the actionscript for the frame.

what do you mean by tbox.htmlText = "<img src='jag1.jpg'>"; ? does that go
in the variable field?
thanks so much.
Re: html and images in flash Pea
4/17/2004 4:38:09 AM
Hi,

I always thought it wasnt possible to display images in a text field in flash,
only simple text formatting like colours and bold? Maybe they fixed it with
MX...

I do know what kglad means though. You can give your text box an instance
name, just like you give other clips a name. You can then access its htmlText
property and insert HTML in there. Don't use the variable field at all.

For example:
// load your text file at this point. text from file stored in variable called
'my_text';
my_mc.createTextField(my_textfield, 100, 0, 0, 300, 200);
my_textfield.htmlText = my_text;

Hope it helps,
Pea
Re: html and images in flash jaste
4/17/2004 7:19:18 AM
Hi,

There's a nice tutorial around [L=here]http://www.nwebb.co.uk/nw_htmlsite/index.php?page=browse_tutorial&tutorial=imagesxml1&part=1[/L]

Re: html and images in flash Laiverd.COM
4/17/2004 10:40:43 AM
Hi Kenny,

Read your mail ;-) Anyway the basics setup for loading an image in an HTML
enabled textfield.

Prerequisites: FMX2004 and publishing for flash player 7; jpg file only
which is saved non-progressive

1. create a textfile with the following:
&myVar=This is some <b>html</> text with an accompanying image. <img
src="myimage.jpg" width="150" height="100"><br>The image can only be a
non-progressive jpg (or an swf or linked movieclip for that matter.&
2 save the textfile and the image in the same folder as where the final swf
and html will be (just for convenience now). Name the textfile: mydata.txt
and make sure it is saved with UTF8 encoding.
3. start a new Flash document and draw a textfield; give the textfield the
instancename "myText_txt" in the propertiespanel
4. In the frame where the textfield sits, write this script:
// create a new LoadVars object
var myData = new LoadVars();
// write a function that will deal with the loaded data as soon as they have
been loaded
myData.onLoad = function (success){
if(success){
myText_txt.htmlText = this.myVar;
}
}
// actually start loading the textfile
myData.load("mydata.txt");
5. Hit CTRL-Enter to test the movie. If everything was done as expected you
should now see the text and the image in the textfield called "myText_txt".

It is no problem to have textfiles and images in another folder than the swf
file and HTML file in which the swf is embedded. Only thing to make sure is
that the path to any file to be externally loaded has to start from the
HTML-file location.

Hope it works by now ;-)

John

--
----------------------------------------------------------------------------
-----------
RESOURCES
http://groups.google.com/advanced_group_search?hl=en&as_ugroup=*flash
----------------------------------------------------------------------------
-----------
TUTORIALS at
www.laiverd.com
Flash & PHP Emailform
Using textfiles in Flash
----------------------------------------------------------------------------
-----------

Re: html and images in flash herod2221
4/17/2004 6:46:03 PM
hey guys-
john: i followed your directions EXACTLY and i still can't get it to work! i
don't know why this is so tempermental.

the tutorial posted by jaste worked, though, and until i can get the simple
method you've all been describing to work, i guess i'm going to have to do it
that way (though i don't want to as it requires a few extra steps, and i'm not
the one who'll be updating this in the future).

i'd still like to get this to work, if you have any other tips i'm willing to
try anything. i attached the .fla, the jpg, and the .txt in a zipped file - if
you have time to check the code to see if i'm off somewhere, i appreciate it.
if not, i understand. i wonder if there's some glitch in my software?
kenny

AddThis Social Bookmark Button