Good question. Maybe you can see how it works, if you compile with -keep to keep the generated code? Cheers, Ralf
On 12/13/06, Johannes Nel <[EMAIL PROTECTED]> wrote:
hi ralf :) how does the framework then detect changes to xml for databinding purposes? but thanks btw. i was trying to be lazy just adding a watcher in one place vs 20 odd places :( johan On 12/13/06, Ralf Bokelberg <[EMAIL PROTECTED]> wrote: > Hi Johannes, > i wouldn't expect this to work. This ChangeWatcher only fires, if you > assign something to __dataCopy, eg. > > ---------------------------------------------- snip > -------------------------------------------------- > > <?xml version="1.0" encoding="utf-8"?> > <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" > layout="vertical" creationComplete="onCreationComplete()"> > > <mx:Script> > <![CDATA[ > > import mx.binding.utils.ChangeWatcher; > > [Bindable] > public var __dataCopy : XML; > > private function onCreationComplete() : void > { > trace("ApplicationEntry::onCreationComplete " + url ); > onCC(); > } > > private function onCC():void > { > > ChangeWatcher.watch(this, "__dataCopy", > watcherListener); > __dataCopy = new XML("<node1/>"); > > } > > private function watcherListener(evt:Event):void > { > trace("hhh:"); > } > ]]> > </mx:Script> > > </mx:Application> > > ---------------------------------------------- snip > -------------------------------------------------- > > This works fine. Since XML doesn't seem to have other bindable > properties, any changes below __dataCopy can't be watched. > Cheers, > Ralf. > > > On 12/13/06, Johannes Nel < [EMAIL PROTECTED]> wrote: > > > > bump > > how does the framework then detect changes to XML objects? is this > > possible? > > ... > > > > On 12/12/06, Johannes Nel < [EMAIL PROTECTED]> wrote: > > > > > > hi > > > > > > when i go changewatcher.canWatch(this,"someXMLObject"); > > > the result is true. > > > > > > however when i do add a watch it never fires (code sample below) and > > > when i use the getEvents method the object returned is empty. > > > whats up with this seeming contradiction, and how does binding then > > > work on XML objects!! > > > private function onCC():void > > > { > > > > > > __dataCopy = new XML("<node1/>"); > > > ChangeWatcher.watch(this, "__dataCopy", > > > watcherListener); > > > > > > var p:XML = new XML("<node2/>"); > > > //at this stage the watcher should fire IMO... > > > __dataCopy.appendChild(p); > > > > > > // var o:Object = ChangeWatcher.getEvents(this,"__dataCopy"); > > > } > > > private function watcherListener(evt:Event):void > > > { > > > trace("hhh:"); > > > } > > > > > > thanks > > > johan > > > > > > -- > > > j:pn > > > http://www.lennel.org > > > > > > > > > > > > > > > > -- > Ralf Bokelberg <[EMAIL PROTECTED] > > Flex & Flash Consultant based in Cologne/Germany > > -- j:pn http://www.lennel.org
-- Ralf Bokelberg <[EMAIL PROTECTED]> Flex & Flash Consultant based in Cologne/Germany