6 Replies Latest reply on Feb 22, 2011 11:51 AM by Flex harUI

    How to trigger function when XML changes ?

    eprevot123 Level 2

      Hi

      how would you do to call a function each time a XML changes ?

       

      I have a Bindable XML :

      var myXML:XML =

      <data>

           <node>

                <subNode/>

                <subNode/>

           </node>

           <node>

                <subNode/>

                <subNode/>

           </node>

      </data>

       

      I want a function to be called when the XML changes, not only when myXML is reassigned but also when some node is added to the XML or an attribut of subNode has changed.

       

      So I use : BindingUtils.bindSetter( functionToBeCalled, this, "myXML");

      But the function is called only when I do myXML = new XML(...) and not when I do myMXL.insertChildAfter() for example.

       

      1. Why when I bind something on myXML, the property_changed event is not dispatched when myXML.node changes ?

      2. Do I have to dispatch an event each time I modify the XML in the code, and set functionToBeCalled as the listener of this event, or is there another solution ?