Timing is probably your problem. But anyway there's another solution to accomblish your task you might want to consider. If products is your dataProvider Array then you can bind to it via
<mx:Binding source="products" destination="this.productsChanged" /> and handle it via getter / setter properties public function get productsChanged() : Array { return _productsChanged; } public function set productsChanged( newProductsChanged : Array) { update( newProductChanged ); _productsChanged = newProductsChanged; } private var _productsChanged : Array; in update you can access the updated dataProvider, delegating to other tasks such as calculating a sum. The textfields could then i.e. bind to simple properties of your model. Best, Alex -- Alex Uhlmann Software Engineer iteration::two -----Original Message----- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] Behalf Of Johnny Sent: 14 July 2005 01:45 To: flexcoders@yahoogroups.com Subject: [flexcoders] modelChanged event Hi, I have a DataGrid control and use addItem and removeItemAt method to add and remove items. This works properly. At the same time, I need to dynamically calculate the sum for certain field in the DataGrid and bind the result to a text field. I add a listener for modelChanged event of dataProvider and add a sum function there. But the sum function never gets triggered at all even after an item is added, deleted or all items are removed. The array that binds to the dataProvider will create after a remote service call. The listener is created at the initialize function of the appliation. Could this be a problem? Thanks, J -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/