1

In the code below, when responses come back from the server for the b and c calls, I have the impression that the resposes are randomly given to b and c. The geometry service doesn't know which object is the owner of each response.

Do I need to declare a GemetryService in B and in C?

Class A{
    public static const SERVICE:GeometryService = new GeometryService(url);
}

Class B{
    function callService(){
        ...
        SERVICE.buffer(geometries, responseHandler);   
    } 

    function responseHandler(event:GeometryServiceEvent){
        ...
    }
}

Class C{
    function callService(){
        ...
        SERVICE.buffer(geometries, responseHandler);   
    } 

    function responseHandler(event:GeometryServiceEvent){
        ...
    }
}

Class D{
    function method(){
        var c:C = new C();
        c.callService();

        var b:B = new B();
        b.callService();
    } 
}
1

i'm not sure that's true but you can test by passing in a token to the response handler that IDs where the response is coming from.

  • I created an instance of the GeometryService in each class. That resolved the problem. – yo_haha Apr 10 '14 at 8:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.