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
base class A initilize
public function initialize():void
// call to server to check session time out.
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?
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.