Groups | Blog | Home
all groups > flash data integration > december 2004 >

flash data integration : loading html content from an asp-file into flash


sven boets
12/19/2004 4:11:24 PM
i need to load html content from an asp-file into a flash movie
the sorce that comes out of the asp file is html code
ex: <p><font size="20">text...</font></p> etc.
i use this script to load the external asp-file

myData = new LoadVars();
myData.load("http://www.leveljay.net/biography.asp");
myData.onLoad = LoadData;

function LoadData(success) {
if (success) { trace ("HTML is loaded");
trace (myData);
_root.displayxml.presentatiebiography = myData;
} else trace("Error loading data")
}

when it is loaded the html tags are replaced bij %3c and %3e etc.
ex:
%3CP%3E%3CFONT%20size=2%3E%3C%2FFONT%3E%3C%2FP%3E&onLoad=%5Btype%20Function%5D

and than the last part of te outcome --> &onLoad=%5Btype%20Function%5D
where does that come from??

what do i do wrong??
Pilipo
12/19/2004 6:14:50 PM
LoadVars was made to load name/value pairs, not XML. Try the XML Object or the
XML Connector. XML Object can be used just like the LoadVars, so it's easier to
try first. All you have to change is the myData = new LoadVars(); to myData =
new XML();

Instead of saying trace(myData) just say trace(this). You should see your XML
in the trace.

The reason onLoad traced out is that you said trace(myData). This traces all
the contents of myData. One piece of content is the data, the other is the
onLoad function you created. That is what you're seeing.
sven boets
12/19/2004 11:01:34 PM
thanks Pilipo

but i stil don't have what i should have :-/
i changed the new loadVars to new XML
and now a have this result with the trace function

HTML is loaded
<P />

so the only result in my xml variable is "<P />" and this is even not in the
outcome of the asp-file
i did try also the "trace(this);" but same result

i tried this before i tried the new LoadVars() and had the same result as now
so thats why i tried the LoadVars
but than i got the % ...

what can be the reason for this wierd result??
my asp-file works correct
or should an XML file always begin with <?xml version="1.0" encoding="UTF-8"
?>
might that be the reason?
Pilipo
12/20/2004 6:48:02 PM
I would check your XML. The XML has to be wrapped by an entire node.
This example will not work:
<p><font size=+1>This is a test</font></p><p>This is regular text</p>
because there is no node that wraps the whole string.
This example will work:
<body><p><font size=+1>This is a test</font></p><p>This is regular
text</p></body>
When you trace(this), your entire xml string should print. Good luck!
AddThis Social Bookmark Button