2 Replies Latest reply on May 28, 2009 7:25 AM by Michael Borbor

    Flex Error

    pftec

      I try to change the Textbox's text property value which is in other Tab. But it displays the below error. please help me.

       

      Error Message :

      ===============

       

      TypeError: Error #1009: Cannot access a property or method of a null object reference.

                      at com.Master::MasterOrganisation/getOrgData()[E:\Flex\WorkForce\src\com\Master\MasterOrgani sation.mxml:179]

                      at com.Master::MasterOrganisation/__btnOrgEdit_click()[E:\Flex\WorkForce\src\com\Master\Mast erOrganisation.mxml:273]

       

       

       

       

      Coding :

      =======

       

      <?xml version="1.0" encoding="utf-8"?>

      <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="555" height="342">

      <mx:WebService id="myService

                  wsdl="http://localhost/WorkforceWebService/Service1.asmx?WSDL

                  load="myService.getOrg()" 

                  showBusyCursor="true">

            </mx:WebService> 

       

            <mx:Script>

                  <![CDATA[

                        import mx.controls.dataGridClasses.DataGridItemRenderer;

       

                      import mx.controls.Alert;

                      import mx.rpc.events.FaultEvent;

                      import mx.rpc.events.ResultEvent;

                      import mx.rpc.soap.mxml.WebService;

                      import mx.managers.CursorManager;

       

       

                              import mx.controls.DataGrid;

                              import mx.controls.dataGridClasses.DataGridColumn;

                              import mx.collections.ArrayCollection;

                              import mx.collections.XMLListCollection;

                              import mx.collections.IList;

                              import mx.collections.IViewCursor;

                              import mx.collections.CursorBookmark;

           

                      /**

                      * @bindable

                      * @private

                      * @property Will hold the data passed from the web service.

                      */

                      [Bindable]

                      private var _xmlOrgData:XML;

                              private var m_orgCode:String;

       

      private function getOrgData(event:MouseEvent):void

                              {

                                    orgTab.selectedIndex=1;

                                    orgTab.getChildren();

                                    txtOrgCode.text=dgOrgList.selectedItem.OrgCode;

                                    /*txtOrgName.text=dgOrgList.selectedItem.OrgName;

                                    txtOrgAddress.text =dgOrgList.selectedItem.Address;

                                    txtOrgCity.text =dgOrgList.selectedItem.City;

                                    btnOrgSave.label="Update";*/

                                   

                                   

                              }

       

       

                  ]]>

          </mx:Script>

      <mx:TabNavigator id="orgTab" width="555" height="342">

       

      <mx:Canvas label="List / Search" width="100%" height="100%">

                  <mx:DataGrid id="dgOrgList" x="10" y="45" width="533" dataProvider="{_xmlOrgData.*}">

                        <mx:columns>

                              <mx:DataGridColumn headerText="Code" dataField="OrgCode"/>

                              <mx:DataGridColumn headerText="Name" dataField="OrgName"/>

                              <mx:DataGridColumn headerText="Address" dataField="Address"/>

                              <mx:DataGridColumn headerText="City" dataField="City"/>

                        </mx:columns>

                  </mx:DataGrid>

                  <mx:ComboBox id="cboOrgFilter" initialize="fillOrgFilter1('select \'\' as OrgCode,\'\' as OrgName union all select OrgCode,OrgName from Organisation order by 2');" labelField="OrgName" dataProvider="{_xmlOrgFilter.*}" x="77" y="15" width="251" >

                  </mx:ComboBox>

                 

                  <mx:Label x="10" y="17" text="Name :" width="59"/>

                  <mx:Button x="336" y="15" label="Search" id="btnOrgSearch" click="clickOrgHandler(event);"/>

                  <mx:Button x="404" y="15" label="Edit" id="btnOrgEdit" click="getOrgData(event);" width="71"/>

                  <mx:Button x="478" y="15" label="Delete" id="btnOrgDelete" />

            </mx:Canvas>

      </mx:TabNavigator>

       

      </mx:Canvas>