Ola, Já verificou se o seu ArrayCollection "formadoras" não está nulo na função Result "handleLoadResult".
Provavelmente é esse o problemar pois no erro diz que não consegue acessar a propriedade da linha 68 (formadoras.length). Att, -- Tiago Antonio Jacobi Representante [EMAIL PROTECTED] Butiking Futebol Clube. 2008/11/21 Leonardo Aleixo da Silva <[EMAIL PROTECTED]> > Ola galera > estou tendo o seguinte erro na minha aplicação flex+java > > TypeError: Error #1009: Cannot access a property or method of a null object >> reference. >> at >> br.edu.claretiano.view::ListFormadoras/handleLoadResult()[C:\Documents and >> Settings\leonardo\workspace\EscolaFabricaWeb\flex_src\br\edu\claretiano\view\ListFormadoras.mxml:68] >> at >> br.edu.claretiano.view::ListFormadoras/__loaderService_result()[C:\Documents >> and >> Settings\leonardo\workspace\EscolaFabricaWeb\flex_src\br\edu\claretiano\view\ListFormadoras.mxml:13] >> at flash.events::EventDispatcher/dispatchEventFunction() >> at flash.events::EventDispatcher/dispatchEvent() >> at >> mx.rpc::AbstractService/dispatchEvent()[E:\dev\3.1.0\frameworks\projects\rpc\src\mx\rpc\AbstractService.as:237] >> at >> mx.rpc.remoting.mxml::RemoteObject/dispatchEvent()[E:\dev\3.1.0\frameworks\projects\rpc\src\mx\rpc\remoting\mxml\RemoteObject.as:213] >> at mx.rpc::AbstractOperation/ >> http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()[E:\dev\3.1.0\frameworks\projects\rpc\src\mx\rpc\AbstractOperation.as:202] >> at mx.rpc::AbstractInvoker/ >> http://www.adobe.com/2006/flex/mx/internal::resultHandler()[E:\dev\3.1.0\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:193] >> at >> mx.rpc::Responder/result()[E:\dev\3.1.0\frameworks\projects\rpc\src\mx\rpc\Responder.as:43] >> at >> mx.rpc::AsyncRequest/acknowledge()[E:\dev\3.1.0\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:74] >> at >> NetConnectionMessageResponder/resultHandler()[E:\dev\3.1.0\frameworks\projects\rpc\src\mx\messaging\channels\NetConnectionChannel.as:491] >> at >> mx.messaging::MessageResponder/result()[E:\dev\3.1.0\frameworks\projects\rpc\src\mx\messaging\MessageResponder.as:199] >> > -- > a minha classe é esta > > >> 1. <?xml version="1.0" encoding="utf-8"?> >> 2. <mx:Panel >> 3. xmlns:mx="http://www.adobe.com/2006/mxml" >> 4. xmlns:view="br.edu.claretiano.view.*" >> 5. width="100%" >> 6. height="100%" >> 7. title="Escola de Fabrica - Existem {formadoraRecords} >> formadoras." >> 8. creationComplete="chamaFormadoras();"> >> 9. >> 10. <mx:RemoteObject >> 11. id="loaderService" >> 12. destination="formadoraService" >> 13. result="handleLoadResult(event)" >> 14. fault="handleFault(event)" >> 15. showBusyCursor="true"/> >> 16. <mx:RemoteObject >> 17. id="deleteService" >> 18. destination="formadoraService" >> 19. result="handleDeleteResult(event)" >> 20. fault="handleFault(event)" >> 21. showBusyCursor="true" /> >> 22. >> 23. <mx:Script> >> 24. <![CDATA[ >> 25. import br.edu.claretiano.vo.Formadora; >> 26. import mx.controls.Alert; >> 27. import mx.managers.PopUpManager; >> 28. import mx.containers.TitleWindow; >> 29. import mx.collections.ArrayCollection; >> 30. import mx.rpc.events.ResultEvent; >> 31. import mx.rpc.events.FaultEvent; >> 32. >> 33. [Bindable] >> 34. private var message:String; >> 35. >> 36. [Bindable] >> 37. private var formadoras:ArrayCollection = new >> ArrayCollection(); >> 38. >> 39. [Bindable] >> 40. private var formadoraRecords:int = 0; >> 41. >> 42. public function chamaFormadoras():void { >> 43. loaderService.obterTodas(); >> 44. } >> 45. >> 46. private function deleteFormadora():void { >> 47. if(dataGrid.selectedItem != null) { >> 48. var selectedItem:Formadora = >> dataGrid.selectedItem as Formadora; >> 49. >> deleteService.excluir(selectedItem.formadoraId); >> 50. } >> 51. } >> 52. >> 53. private function createFormadora():void { >> 54. var titleWindow:FormadoraForm = >> FormadoraForm(PopUpManager.createPopUp(this, FormadoraForm, true)); >> 55. titleWindow.setStyle("borderAlpha", 0.9); >> 56. titleWindow.formIsEmpty = true; >> 57. } >> 58. >> 59. private function updateFormadora():void { >> 60. var titleWindow:FormadoraForm = >> FormadoraForm(PopUpManager.createPopUp(this, FormadoraForm, true)); >> 61. titleWindow.setStyle("borderAlpha", 0.9); >> 62. titleWindow.formadora = dataGrid.selectedItem as >> Formadora; >> 63. titleWindow.formIsEmpty = false; >> 64. } >> 65. >> 66. private function handleLoadResult(ev:ResultEvent):void >> { >> 67. formadoras = ev.result as ArrayCollection; >> 68. formadoraRecords = formadoras.length; >> 69. } >> 70. >> 71. private function >> handleDeleteResult(ev:ResultEvent):void { >> 72. Alert.show("The consultant has been deleted.", >> "Information", Alert.OK, null, null, null, Alert.OK); >> 73. chamaFormadoras(); >> 74. } >> 75. private function handleFault(ev:FaultEvent):void { >> 76. message = "Error: " >> 77. + ev.fault.faultCode + " - " >> 78. + ev.fault.faultDetail + " - " >> 79. + ev.fault.faultString; >> 80. } >> 81. ]]> >> 82. </mx:Script> >> 83. <mx:VBox width="100%" height="100%"> >> 84. <mx:Label text="{message}" fontWeight="bold" >> includeInLayout="false" /> >> 85. <mx:DataGrid >> 86. id="dataGrid" >> 87. width="100%" >> 88. height="100%" >> 89. dataProvider="{formadoras}" >> 90. doubleClickEnabled="true" >> 91. doubleClick="updateFormadora()" > >> 92. <mx:columns> >> 93. <mx:DataGridColumn dataField="formadoraId" >> 94. headerText="Formadora Codigo" >> 95. width="100"/> >> 96. <mx:DataGridColumn dataField="Nome" >> 97. headerText="Nome" /> >> 98. </mx:columns> >> 99. </mx:DataGrid> >> 100. >> 101. <mx:ControlBar horizontalAlign="center"> >> 102. <mx:Button label="Criar Formadora" >> 103. click="createFormadora()" >> 104. toolTip="Create a new consultant and store it in >> the database." /> >> 105. <mx:Button label="Alterar Formadora" >> 106. click="updateFormadora()" >> 107. enabled="{dataGrid.selectedItem}" >> 108. toolTip="Update an existing database consultant." >> /> >> 109. <mx:Button label="Apagar Formadora" >> 110. click="deleteFormadora()" >> 111. enabled="{dataGrid.selectedItem}" >> 112. toolTip="Delete the consultant from the >> database." /> >> 113. <mx:Button label="Atualizar" >> 114. click="chamaFormadoras()" >> 115. toolTip="Reload the consultant list from the >> database." /> >> 116. </mx:ControlBar> >> 117. </mx:VBox> >> 118. </mx:Panel> >> >> > ___ > Leonardo Aleixo da Silva > > > > > --~--~---------~--~----~------------~-------~--~----~ Você recebeu esta mensagem porque está inscrito na lista "flexdev" Para enviar uma mensagem, envie um e-mail para [email protected] Para sair da lista, envie um email em branco para [EMAIL PROTECTED] Mais opções estão disponíveis em http://groups.google.com/group/flexdev -~----------~----~----~----~------~----~------~--~---
