Page 1 of 1

loading xml file from flash

Posted: Tue Aug 22, 2006 1:20 pm
by tonychan
Hi Softanics Site Admin,

My swf file need to load a xml file using the following method:

AS2
------------------------------------------------------
var xmlFile:XML = new XML();
xmlFile.ignoreWhite = true;
xmlFile.onLoad = function(success:Boolean) {...}
xmlFile.load("abc.xml");
------------------------------------------------------

VB.NET
------------------------------------------------------
Private Function FlashPlayerControl1_OnLoadExternalResource(ByVal strRelativePath As String) As System.IO.Stream Handles FlashPlayerControl1.OnLoadExternalResource

If strRelativePath = "abc.xml" Then
Return xmlStream
End If

Return Nothing

End Function
-------------------------------------------------------


This method does not work. It's the AS problem or the VB.NET problem? Do you have any solution to load the xml file to flash?

Thx a lot!

Tony Chan

Posted: Tue Aug 22, 2006 4:32 pm
by Softanics
Thank you for your question.

Do you load the swf from a stream?

Posted: Wed Aug 23, 2006 2:12 am
by tonychan
Yes. Both the swf and xml files are also loaded from stream.

In the sample files, I found that the "FlashPlayerControl1_OnLoadExternalResource" function in VB.NET is worked well with the "loadmovie()" function in AS2. However, is the "FlashPlayerControl1_OnLoadExternalResource" function in VB.NET worked with the "XML.load()" and "MovieClipLoader.loadClip()" functions in AS2 ?

Posted: Wed Aug 23, 2006 6:40 am
by Softanics
Yes, it works. See this example:
http://f-in-box.com/TEMP/LoadXMLFromStream.zip

It demonstrates how to provide xml content from a stream.