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.
co开发者_高级运维de 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));
}
}
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.
精彩评论