Omu
Omu

Reputation: 71188

flex: Unhandled AsyncErrorEvent when connecting to the server

I've created a custom class to handle method calls from the server and I get this error

Error #2044: Unhandled AsyncErrorEvent:. text=Error #2095: flash.net.NetConnection was unable to invoke callback close. error=ReferenceError: Error #1069: Property close not found on MyClient and there is no default value.

code from function that does the connection:

    myClient = new MyClient();
    myClient.addEventListener(HearEvent.HEARD_SOMETHING,onHear);

    nc = new NetConnection();           
    nc.addEventListener(NetStatusEvent.NET_STATUS, ncOnStatus);
    nc.client = dasClient;          
    nc.connect(connectStr.text, p1.text, p2.text, int(p3.text), p4.text);

that's the MyClient class

public class MyClient extends EventDispatcher
{   
    public function hear(s:String):void
    {
        trace(s);
        dispatchEvent(new HearEvent(s, HearEvent.HEARD_SOMETHING));
    }
}

Upvotes: 1

Views: 1655

Answers (1)

Amarghosh
Amarghosh

Reputation: 59451

Depending on your requirements, you can either ignore this error by handling the AsyncErrorEvent in an empty function or prevent the error from happening by adding a close method to the MyClient that performs appropriate action.

Upvotes: 1

Related Questions