|
|
|||||
Регистрация: Apr 2010
Сообщений: 67
|
Ошибка при работе с XMLNotifier
Здравствуйте,
Нужно отслеживать изменения XMLList, делаю так: import mx.utils.XMLNotifier; public var updateWatch:XMLNotifier = XMLNotifier.getInstance(); ...... updateWatch.watchXML(Global.usrdb, watch);//<--ошибка private function watch():void{ trace("Изменено!") } Не понимаю, вроде все сделал по хелпу. |
|
|||||
Modus ponens
|
А зачем в хелп смотреть, если это на поверхности плавает?
public function watchXML(xml:Object, notifiable:IXMLNotifiable, uid:String = null):void { if ((xml is XMLList) && xml.length() > 1) { for each(var item:Object in xml) { watchXML(item, notifiable, uid); } } else { // An XMLList object behaves like XML when it contains one // XML object. Casting to an XML object is necessary to // access the notification() function. var xmlItem:XML = XML(xml); // First make sure the xml node has a notification function. var watcherFunction:Object = xmlItem.notification(); if (!(watcherFunction is Function)) { watcherFunction = initializeXMLForNotification(); xmlItem.setNotification(watcherFunction as Function); if (uid && watcherFunction["uid"] == null) watcherFunction["uid"] = uid; } // Watch lists are maintained on the notification function. var xmlWatchers:Dictionary; if (watcherFunction["watched"] == undefined) watcherFunction["watched"] = xmlWatchers = new Dictionary(true); else xmlWatchers = watcherFunction["watched"]; xmlWatchers[notifiable] = true; } }
__________________
Hell is the possibility of sanity |
|
|||||
Регистрация: Apr 2010
Сообщений: 67
|
Сам пока с трудом въезжаю, поэтому и спросил
Добавлено через 49 часов 50 минут Решил проблему так: обернул XMLList в XMLListCollection, а у него уже есть стандартный слушатель изменений. Все работает. |
Часовой пояс GMT +4, время: 21:11. |
|
« Предыдущая тема | Следующая тема » |
|
|