function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
prageethprageeth 

Problem in salesforce offline app created by using Adobe AIR and Flex

    I am trying to create an application, by using which the user can see his salesforce data even if he is offline. I am using adobe AIR and Flex with 'as3SalesforceAIR' and 'as3Salesforce' libraries.
Following is a part of code in my application.
   
        var lreq:LoginRequest = new LoginRequest({
    username: txtUserName.text,
    password: txtPassword.text,
    callback: new AsyncResponder(function (result:Object):void {
       })});
       airConnection.login(lreq);
       getOpportunities();

     <airforce:AIRConnection id="airConnection"/>

    In the getOpportinities() function I have the code which queries the required salesfore data.
My problem is, when the user runs my application for the very first time it gives an error. As I believe this occurs because the getOpportunities() function runs as soon as the "airConnection.login(lreq);" line is executed. As I think the "airConnection.login(lreq)" method requires a little time to complete the login process. But before it gets completed the "getOpportunities()" method starts to run. Therefore an error occurs because data can't be queried until the login process is completed.
    Sometimes the reason for the problem may be another one. Can anybody suggest an idea about my problem? or is there a method to delay the execution of "getOpportunities()" method until the login process is completed. Thank you.