all groups > macromedia flash flashcom > may 2007 >
You're in the

macromedia flash flashcom

group:

problem with loading xml


problem with loading xml flairman
5/21/2007 12:00:00 AM
macromedia flash flashcom:
i tried to load xml
but nothing happend
application.onConnect = function(newClient, name)
{
application.acceptConnection(newClient);
var flooring = new XML();
flooring.ignoreWhite = true;

flooring.onLoad = function(success) {
trace(success);
};

flooring.load("Gallery.xml");
}

what is wrong? do i need to change port?
Re: problem with loading xml dfm_
5/21/2007 12:00:00 AM
var flooring:XML = new XML();
flooring.ignoreWhite = true;
flooring.onLoad = function(success:Boolean) {
if (success) {
trace(flooring);
} else {
trace("could not find XML");
}
};
flooring.load("Gallery.xml");

if this could not work, then is application.onConnect
Re: problem with loading xml JayCharles
5/21/2007 1:46:45 PM
I've never had success loading a local XML file in FMS... always get the same
error as you.

My solution is to use the File() object to read the XML file into a string,
and then use xml.parseXML() to create an XML object from the string.
Re: problem with loading xml cave1
7/18/2007 12:00:00 AM
I'm also having problem loading xml in the fms2.
i did one function for testing porpuse :
application.getDBHello= function(){
var login_str = "<login username=\"servidor\"password=\"servpass\" />";
var my_xml = new XML(login_str);
this.myLoginReply_xml = new XML();
this.myLoginReply_xml.ignoreWhite = true;
this.myLoginReply_xml.onLoad= function(success) {
trace("Estamos no Onload: "+success);
trace(this.myLoginReply_xml);
if (success) {
trace("primeiro n? ="+this.firstChild.nodeName)

} else {
trace("something went wrong!!!! =P")
}
};
this.myLoginReply_xml.onData=function (mdata){
trace("executing on DATA "+mdata);
trace("my state "+this.loaded)
}
my_xml.sendAndLoad(this._dataServer,this.myLoginReply_xml);
}

and o call it from inside the application.onConnect

if you try this you will see that the onData is fired but not the onLoad.

In fact if you get to the documentation of "Server-Side ActionScript Language
Reference" for fms2 you'll find the following information:
"When the load() method is executed, the XML object property loaded is set to
false.
When the XML data finishes downloading, the loaded property is set to true,
and the
onLoad event handler is invoked. The XML data is not parsed until it is
completely
downloaded. If the XML object previously contained any XML trees, they are
discarded.
You can define a custom function that executes when the onLoad event handler
of the XML
object is invoked."

I tested the xml.loaded var in the onData and returned false. It should be
true so that onLoad is executed.
Do you think this is a bug?
AddThis Social Bookmark Button