Skip navigation
Currently Being Moderated

Synchronous calls

Aug 15, 2012 11:30 AM

I have a class B that is based on another class A.

Base class A has method initialize that is overridden like this in class B:

public override function initialize():void

{

                              super.initialize();

setupControls();

}

base class A initilize

public function initialize():void

{

     // call to server to check session time out.

     callToServer(callfunction, onResult);

}

private function onResult ...

{

}

 

What happens is that  setupControls(); will run not waiting on onResult  to execute.

Any chance to control this: to wait for results of callToServer to arrive?

 

Thanks

 
Replies
  • Currently Being Moderated
    Aug 15, 2012 11:48 AM   in reply to Zolotoj

    Nope, no way to do that AFAIK.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 15, 2012 12:36 PM   in reply to Zolotoj

    Code the class properly to handle asynchronous data.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 15, 2012 1:31 PM   in reply to Zolotoj

    Why is that?

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 15, 2012 1:49 PM   in reply to Zolotoj

    You need to inject asynchronous handlers into that code somehow.

     

    Since you have the code it should be possible - either by affecting the inheritance hierarchy, decorating the classes somehow or just plain code refactoring with some kind of automated edit.

     

    I think you're wasting your time looking for some synchronous hook. If you managed to find it, it would potentially kill your UI if the remote call took any length of time.

     

    I don't think there's any magic bullet here to save refactoring the code.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points