Skip to main content
Known Participant
February 16, 2007
Question

xml file not loading

  • February 16, 2007
  • 3 replies
  • 238 views
i am trying to create an e-learning course that will have glossaries according to the various lessons that are within the overall course. i have attached the code that i am using to quickly switch out the glossary xml file (that contains the definitiosn and terms). I can currently trace the lessonNumber variable (it is reading "1"), but when I attempt to trace the glossaryText variable, the output window is blank....can anyone tell me where i am going wrong?
This topic has been closed for replies.

3 replies

Inspiring
February 16, 2007
Just a hint - perhaps try putting your onLoad declaration BEFORE your load command. This way, your onload is present before the load is issued, so in case the XML is loaded really quickly, the onLoad handler will get called for sure. Does this make sense? In your case, the XML may have already loaded before you tell the object WHAT to call after it's loaded.

When I've used the xml object, it looks more like this:
myXML = new XML();
myXML.onLoad = someFunction;
myXml.load("somexmlfile.xml");

Also -afterwards, you have to select a node of the XML to view. I use the XPath API to do so, by including this
import mx.xpath.XPathAPI;

And then using:
XPathAPI.selectSingleNode within an onLoad function. Take a look at the documentation for XPathAPI - I had to make a custom function to return the node I wanted.

Hope this helps you.
Mordred58Author
Known Participant
February 16, 2007
i was hoping to even see the object Object.....but i'm not even seeing that. what would be the best way to go about this?
kglad
Community Expert
Community Expert
February 16, 2007
i see a trace(glossaryText) which won't reveal anything because glossaryText is your xml object. glossaryText is not a variable. the most you could hope for is to see [object][object] in the output panel, but even that won't happen with the xml class.