I have been struggling to find a way to do this. Basically, I am committing data to a database that I have assigned all the variables to. However, when it has finished committing that data, I want it to then push to the next view. So far, I can get it to work if I program in another button to push to the next view but I want it to be automated with the one button.
So far my code is:
protected function btnClientSubmit_clickHandler(event:MouseEvent):void
{
repID = RepID.toString();
CompPass = CompID.toString();
clientPass = ClientID.toString();
compaID = parseInt(CompPass);
sessions.SessionID = SessionID.toString();
sessions.RepID = parseInt(repID);
sessions.CompanyID = compaID;
sessions.CustID = clientID;
sessions.Status = 'Open';
createSessionsResult.token = sessionsService.createSessions(sessions);
createSessionsResult.token = sessionsService.commit();
navigator.pushView(CheckOut);
}
It works 100% for committing so that is not a problem and hence I did not include all the other code. My problem comes with the fact that the program is pushing to the next view too soon and it interrupts my data insert.