0 Replies Latest reply on Sep 9, 2011 1:15 AM by Rabby_1888

    Is it possible to maintain ResultEvent data?

    Rabby_1888

      Hi,

       

      I'm fairly new to Flex and have been frustrated in my attempts to store the result data of a ResultEvent to a global variable for later use but have had no success thus far.

       

      <fx:Declarations>

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

           <fx:String id="sUsername"/>

            <s:RemoteObject id="userutils" destination="userutils" source="dashboard.utils.UserUtils">

                     <s:method name="getUsername" result="getUsernameHandler(event)" fault="faultHandler(event)"/>

            </s:RemoteObject>

      </fx:Declarations>

       

       

      //functions

       

      private function getUsernameHandler(event:ResultEvent):void{

           var retVal:String = event.result.toString();

           sUsername = retVal;

      }

       

       

      private function faultHandler(event:FaultEvent):void{

      Alert.show(event.fault.toString());

      }

       

       

       

      public function getUserDetails(corpdomName:String){

           userutils.getUsername(networkName);

           //creates gui

           buildUserView();

      }

       

       

       

      Essentially after the getUsernameHandler completes sUsername remains blank, however if I were to insert an Alert.Show(sUsername) within getUsernameHandler an Alert will display with the correct information. I have had some success in using a SharedObject to store this information but it seems that the Flex application will use the SharedObject from the previous session which has left me even more confused.

       

      Any ideas if this can be done?

       

      Thanks in advance for any help.

       

      -Rab