So is there an error? What's the problem? -----Original Message----- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of jeffrey_lage Sent: Monday, March 27, 2006 10:20 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Unable to iterate over results of a call to DataService.fill()
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" creationComplete="init()"> <mx:Script> <![CDATA[ import mx.collections.ListCollectionView; import mx.collections.ICollectionView; import mx.data.messages.DataMessage; import mx.rpc.AsyncToken; import com.fds.ui.TreeNode; import mx.utils.ObjectProxy; import mx.controls.Alert; import mx.collections.ArrayCollection; import mx.rpc.events.ResultEvent; [Bindable] var availableRecs:ListCollectionView = new ListCollectionView( ); [Bindable] var rawRecList:ListCollectionView = new ListCollectionView( ); function init( ):void { this.dataService.fill( this.rawRecList ); } function handleGetAllReconResults(event:ResultEvent):void { if( DataMessage(AsyncToken(event.call).message).operation == DataMessage.FILL_OPERATION ) { Alert.show( this.rawRecList.length.toString() ); var newTree:ArrayCollection = new ArrayCollection( ); var lastDate:String = null; var currentNode:TreeNode = null; for( var i:int = 0; i < this.rawRecList.length; i++ ) { var rec:ObjectProxy = this.rawRecList[ i ] as ObjectProxy; /*if( lastDate != rec.valueDate ) { currentNode = new TreeNode( ); currentNode.label = rec.valueDate; currentNode.guid = rec.guid; newTree.addItem( currentNode ); } else { var child:TreeNode = new TreeNode( ); child.label = rec.runTime; child.guid = rec.guid; currentNode.children.addItem( child ); }*/ //Alert.show("Should be processing item[" + i + "]"); newTree.addItem(rec.guid); } Alert.show( newTree.length.toString() ); this.availableRecs = newTree; } } ]]> </mx:Script> <mx:DataService id="dataService" destination="lineItems" result="this.handleGetAllReconResults(event)" autoCommit="false" fault="Alert.show (event.message.toString())"/> </mx:Application> -- 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/