0 Replies Latest reply on May 14, 2010 3:49 AM by Wave cult

    CallResponder result event not fired

    Wave cult

      Hello,

       

      I'm testing data services integration in Flash Builder...

      In my test app when I click on the "Add" button I open a TitledWindow to permit to add/edit the record/object I pass in the init function of the window.

      When I press "add" on the window I call a service which effectively save the data on the database but doesn't fire the result event and so the related handler function is never executed.

       

      Could someone explain me what I'm wronging ?

       

      Following I report the code I'm using in the window :

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009"
                                   xmlns:s="library://ns.adobe.com/flex/spark"
                                   xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300" xmlns:testtableservice="services.testtableservice.*">
          <s:layout>
              <s:VerticalLayout/>
          </s:layout>

       

          <fx:Script>
              <![CDATA[
                  import mx.controls.Alert;
                  import mx.managers.PopUpManager;
                  import mx.rpc.events.ResultEvent;
                 
                  import valueObjects.TestTable;
                 
                  [Bindable]
                  private var test:TestTable;
                 
                  public function init(anTest:TestTable):void {
                      this.test = anTest;   
                  }
                 
                  protected function button1_clickHandler(event:MouseEvent):void
                  {
                      this.test.TestField = this.txtTestField.text;
                      if (isNaN(this.test.ID))
                          createTestTableResult.token = testTableService.createTestTable(this.test);
                      else
                          updateTestTableResult.token = testTableService.updateTestTable(this.test);                   
                  }

       

                  protected function createTestTableResult_resultHandler(event:ResultEvent):void
                  {
                      this.test.ID = event.result as int;
                      PopUpManager.removePopUp(this);
                  }

       

              ]]>
          </fx:Script>

       

         
          <fx:Declarations>
              <s:CallResponder id="createTestTableResult" result="createTestTableResult_resultHandler(event)"/>
              <testtableservice:TestTableService id="testTableService" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
              <s:CallResponder id="updateTestTableResult"/>
              <!-- Place non-visual elements (e.g., services, value objects) here -->
          </fx:Declarations>
         
          <mx:Form>
              <mx:FormItem label="Label">
                  <s:TextInput id="txtTestField" text="{this.test.TestField}"/>
              </mx:FormItem>
          </mx:Form>
          <s:Button label="add" click="button1_clickHandler(event)" id="button"/>
          <s:Button label="Cancel"/>
      </s:TitleWindow>

       

      Thanks in advance,

      Davide