Friday, April 6, 2007


Disclaimer: Undocumented Classes may be unstable. When Flex is updated, use of this class may cause your code to break.

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:

"Flex", "ActionScript" and possibly "MXML" are probably trademarks of Adobe Systems Incorporated.
"Adobe" is a trademark of Adobe Systems Incorporated.
This site is in no way endorsed or sponsored by Adobe Systems Incorporated.
Content Copyright © 2007 Daniel Freiman.
Site Design Copyright by its copyright holder.
The Flex Non-Docs reserves the right to remove comments for any reason.
All ActionScript and MXML code (and ONLY ActionScript and MXML code) on this website is available under the MIT License.