Skip to main content
Known Participant
August 10, 2008
Answered

My xml Class

  • August 10, 2008
  • 2 replies
  • 427 views
Hello,

I am trying to write an xml parser type class which will read in xml data.

My problem is that when I create an instance of the class and call its load function, it is not waiting for it to load before it continues. I have the code below which is my 'load' function, but i have no way of telling in my document class when it has fully loaded. Is there a way of doing this? When I call loadXML(fileName); Its continuing without waiting for a full load.

This topic has been closed for replies.
Correct answer kglad
dispatch an event from your xmlLoaded function and add a listener for that event to your loadXML instance.

2 replies

kglad
Community Expert
Community Expert
August 10, 2008
you're welcome.
kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
August 10, 2008
dispatch an event from your xmlLoaded function and add a listener for that event to your loadXML instance.
Known Participant
August 10, 2008
How would I dispatch an event from xmlLoaded that would make the document class wait?

Can I listen for the event from a different class? As I'm running myXmlParser.loadXML(fileName); from my document class to implement the above class.

I already have an event listener in the loadXML function, but this doesn't cause the document class to wait until the xml has been loaded into the :XML object.

I can't find it in the AS3 help files and I'm really stumped on this one,,, any help will be very appreciated!

Thank you.

*Edit.....

I have tried inserting dispatcher and listener as bellow into the corresponding functions but this throws up errors 1180: call to a possibly undefined method.


Known Participant
August 10, 2008
It now works perfectly!

I added the dispatcher to the xmlLoader function and the listener to the constructor of the class I wanted to listen for it in.


Thank you Kglad