Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Xml_onLoad

Status
Not open for further replies.

srudin

Programmer
Jan 1, 2002
32
0
0
CH
Hi
when coding inside the Xml.onLoad-function I don't seem to have access to the 'this'-object...
here's an example:

-----
oXml.onLoad = abc();

function abc(success){
trace(eval(this));
}
-----

the trace-function is returning an empty string...
am i doing something wrong...?!

thanks for any hints
 
Here is the "proper form" for do an XML onLoad:

myXML = new XML();
myXML.load("someXMLfile.xml");
myXML.onLoad = doSomething;
function doSomething(success){
if(success){
trace("The XML loaded!");
}else{
trace("XML did not load");
}
}

HTH,

-vedder
-- like what you see? I need a job! =)
 
Oh, I forgot to metion... you can't access "this" in your XML.onLoad() because in your example, there is no object for 'this' to reference. The 'success' argument that is generated and passed to the function you define for your onLoad is just a true/false boolean value, NOT an object. The onLoad does not pass the XML object to whatever function you define... just the true/false.

If you want to "view" your XML, which is what I *think* you are trying to do, you want to do is this:
--------

oXml = new XML();
oXml.load('whatever');
oXml.onLoad = abc();

function abc(success){

if(success){trace(oXml.firstChild);}
}

-----

HTH (sorry for not answering in one post... =)
-vedder
-- like what you see? I need a job =)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top