8 Replies Latest reply on Jul 7, 2010 9:13 AM by Sebastien V.

    Error:# 1009 data/services.. create()

    Rex-on

      It been two days and now I am about to hit the wall... but found this forum. Hopefully, someone can help me. I am having issue with creating/sending information to database (zend framework, php, mySql).

       

      I am creating a simple forum to submit new user. Following is the simplified version as it is happening in all applications. So, I am able to connect to database and retrive data to datagrind. But I am having issue sending new information to the server. I was also able to create and send new data using "Test Operation" but when try to do the same thing with in the application it gives the error message.

       

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

      at myEmployee/button_clickHandler()[/Applications/XAMPP/xamppfiles/htdocs/xampp/Flash Builder Cook Book/src/myEmployee/src/myEmployee.mxml:20]

      at myEmployee/__button_click()[/Applications/XAMPP/xamppfiles/htdocs/xampp/Flash Builder Cook Book/src/myEmployee/src/myEmployee.mxml:54]

       

       

      ********************

       

       

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

      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

         xmlns:s="library://ns.adobe.com/flex/spark"

         xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:employeservice="services.employeservice.*" xmlns:valueObjects="valueObjects.*">

      <fx:Script>

      <![CDATA[

      import mx.controls.Alert;

      import mx.events.FlexEvent;

       

      protected function dataGrid_creationCompleteHandler(event:FlexEvent):void

      {

      getAllEmployeResult.token = employeService.getAllEmploye();

      }

       

       

      protected function button_clickHandler(event:MouseEvent):void

      {

      trace(firstNameTextInput.text);

      trace(lastNameTextInput.text);

      employe.firstName = firstNameTextInput.text.toString();

      employe.lastName = lastNameTextInput.text.toString();

      createEmployeResult.token = employeService.createEmploye(employe);

      //getAllEmployeResult.token = employeService.getAllEmploye();

      }

       

      ]]>

      </fx:Script>

      <fx:Declarations>

      <s:CallResponder id="getAllEmployeResult"/>

      <employeservice:EmployeService id="employeService" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>

      <valueObjects:Employe id="employe"/>

      <s:CallResponder id="createEmployeResult"/>

      <!-- Place non-visual elements (e.g., services, value objects) here -->

      </fx:Declarations>

      <fx:Binding source="dataGrid.selectedItem as Employe" destination="employe"/>

      <mx:DataGrid x="102" y="124" id="dataGrid" creationComplete="dataGrid_creationCompleteHandler(event)" dataProvider="{getAllEmployeResult.lastResult}">

      <mx:columns>

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

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

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

      </mx:columns>

      </mx:DataGrid>

      <mx:Form defaultButton="{button}" x="112" y="318">

      <mx:FormItem label="Id">

      <s:TextInput id="idTextInput" text="{employe.id}"/>

      </mx:FormItem>

      <mx:FormItem label="FirstName">

      <s:TextInput id="firstNameTextInput" text="{employe.firstName}"/>

      </mx:FormItem>

      <mx:FormItem label="LastName">

      <s:TextInput id="lastNameTextInput" text="{employe.lastName}"/>

      </mx:FormItem>

      <s:Button id="button" label="Submit" click="button_clickHandler(event)"/>

      </mx:Form>

      </s:Application>

      ********************
      I don't understand what i wrong with this. The only thing I had to input was the "empolye" on
      createEmployeResult.token = employeService.createEmploye(employe);
      Thanks if advance guys... oo and I am using mac OSX, doesn't know if that matters....

      Rexon