3 Replies Latest reply on Feb 7, 2011 5:21 AM by Pablo Souza

    problem with event handler

    ravi burila

      Hi friends,


      I have a problem,where i have check the result of ResultEvent in a function from where it is raised.


      please help me with an example of appropriate method. if any....



        • 1. Re: problem with event handler
          Pablo Souza Level 3

          Hi Ravi Burila,


          Please provide us additional information about your question.

          If you are doing an HTTPService call for instance, you can do just like below in order to handle the ResultEvent:



          <?xml version="1.0"?>
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
                      import mx.rpc.soap.SOAPFault;         
                      import mx.rpc.events.ResultEvent;                        
                      public function resultEvent_handler(event:ResultEvent):void 
                          // Handle the result event here.
              <mx:WebService id="myService" destination="wsDestination"        
                  <mx:operation name="GetMyService"            
              <mx:TextInput id="myTxt"/>  



          Let me know if you need further information.



          Best regards,

          Pablo Souza

          • 2. Re: problem with event handler
            ravi burila Level 1

            Thanks for your reply

            iam using remote oobject ...

            where i have to store a set of values in database

            //remote call to back end method

            <mx:method name="processTrans" result="transHandler(event) fault="transFault(event)"/>


            //data to be stored in date


            <mx:Repeater id="myRep" dataProvider="{column2}" count="{column2.length/5}">
               <mx:HBox verticalAlign="middle">
                <mx:Label  id="processName" width="260" text="{column2.getItemAt(myRep.currentIndex*5)}"/>
                <mx:TextInput id="startTime" width="100" text="{column2.getItemAt(myRep.currentIndex*5+1)}"/>
               <mx:TextInput id="endTime" width="100" text="{column2.getItemAt(myRep.currentIndex*5+2)}" />
                <mx:TextInput id="remarks" width="180" text="{column2.getItemAt(myRep.currentIndex*5+3)}"/>
                <mx:TextInput id="recordCount" width="80" text="{column2.getItemAt(myRep.currentIndex*5+4)}"/>
                <mx:Button id="submit" label="ADD"  click="addTrans(event.currentTarget as Button);"/>



            Here i have to change the submit button name based on result handler .


            P.S: I fing confused due to presence of event.currentTarget as Button



            • 3. Re: problem with event handler
              Pablo Souza Level 3



              I haven't understood your question.

              Do you want to change the label of the button submit inside the transHandler() method ?


              If so, you can just do this:


              protected function transHandler(event:ResultEvent):void
                   // your implementation ...
                   this.submit.label = "the new label goes here";    


              About the argument event.currentTarget as Button, you are passing the submit button instance to the method addTrans(). Maybe you are trying to modify the label of the button there.



              Best regards,

              Pablo Souza