all groups > flash (macromedia) > september 2004 >
You're in the

flash (macromedia)

group:

Loading HTML into flash


Loading HTML into flash Ben Foster
9/2/2004 9:48:38 PM
flash (macromedia):
Like the LoadMovie command to load .swf files into a main movie, is there
any way you can load html documents into a movie? For example clicking on a
button then a html page loading up beside it, which can then change to
another page upon selecting another button?

Many Thanks in advance,
Ben Foster

Re: Loading HTML into flash David Stiller
9/3/2004 12:00:34 AM
You can't load HTML into Flash -- well, not the way you're thinking.
You *can* use HTML formatting for your text fields, but it's a limited
subset of the full HTML specification (just like you can use some CSS now in
Flash, but that's also very limited). You can import XML into Flash. But
you can't call a loadMovie()-like method that actually loads external HTML
into Flash.

You may be able to accomplish your button goal, though, with the
getURL() method.


David
stiller (at) quip (dot) net

[quoted text, click to view]

Re: Loading HTML into flash Ben Foster
9/3/2004 5:14:32 PM
Ok thanks for your reply. How about this method then. By using this script
you can load external text documents into a flash movie:

loadText = new loadVars();
loadText.load("example.txt");
//creating the loadVarsText function
loadText.onLoad = function() {
scroller.text = this.exampletext;
};

I tried changing the "example.txt." to a htm file, and after changing the
script it works apart from one thing, all the html code is also shown. Is
there anyway i can make a html page, import it into a movie using this
script but keep the html 'invisible' yet working? I tried using the 'render
as html' option but it doesn't seem to work, must be using it for the wrong
purpose.

Many thanks in advance,
Ben Foster

[quoted text, click to view]

Re: Loading HTML into flash David Stiller
9/3/2004 8:26:02 PM
I've never tried what you did, but I wouldn't have expected that to
work. If it did, then it *would* be possible to import HTML into Flash! --
but it isn't possible. :-)

You can try, instead of setting the text property of scroller, to set
its htmlText property (see TextField.htmlText in the ActionScript
dictionary) -- and of course, scroller's HTML formatting will have to be set
to true for that to work. But even if you manage that, you'll be
disappointed, and that's because of how loadVars() works. loadVars()
expects at least one name/value pair. For example, if you had three
external variables you wanted to load -- say, fruit="apple", meat="beef",
veggie="corn" -- your text file would have to be formatted like this:

fruit=apple&meat=beef&veggie=corn

.... so in your case, you'd have to set the whole HTML document as a
URLendcoded value for some variable, for example ...

myHTML=%0chtml%0e%0chead%0e%0ctitle%0eMy%20page%20title ...

In short, bro, Flash doesn't presently allow this.


David
stiller (at) quip (dot) net



[quoted text, click to view]

Re: Loading HTML into flash Ben Foster
9/4/2004 10:41:40 AM
Well thats just gone way over my head! So i think i'll avoid doing that!

Thanks for the help anyways!
Ben Foster

[quoted text, click to view]

AddThis Social Bookmark Button