XMLNotifier allows you to listen to XML and XMLList objects for events. So ask yourself, "Why am I know just wrapping my XML or XMLList in an XMLListCollection, which already supports events? You should only proceed if you have a really good answer.
Code comments in the class state:
"Used for watching changes to XML and XMLList objects. Those objects are not EventDispatchers, so if multiple elements want to watch for changes they need to go through this mechanism. Call watchXML(), passing in the same notification function that you would pass to XML.notification. Use unwatchXML() to remove that notification."This is pretty straight forward.
public function watchXML(xml:Object, notifiable:IXMLNotifiable):void // equivalent to xml.addEventListener(notifiable);
public function unwatchXML(xml:Object, notifiable:IXMLNotifiable):void // equivalent to xml.removeEventListener(notifiable);
Note that this class is a singleton so call XMLNotifier.getInstance() to retrieve the instance.
No comments:
Post a Comment