I have a problem with the following code, which is in an external AS file:
import flash.events.;
import flash.net.;
class myClass extends MovieClip {
private var nc:NetConnection;
private function onLoad(){
init();
}
private function init():Void{
serverPath = “<aServerpath>”;
nc = new NetConnection();
nc.addEventListener(NetStatusEvent.NET_STATUS, netStatus);
nc.addEventListener(SecurityErrorEvent.SECURITY_ERROR, netSecurityError);
nc.connect(serverPath);
}
private function netStatus(event:NetStatusEvent):Void {
switch (event.info.code) {
case “NetConnection.Connect.Success”:
trace(“Connection to server " + serverPath + " succeeded”);
break;
case “default”:
trace(“Connection to server " + serverPath + " failed”);
break;
}
}
private function netSecurityError(event:SecurityErrorEvent):void {
trace("netSecurityError: " + event);
}
}
the error says that ‘the class or interface NetStatusEvent could not be found’ (and the same for SecurityErrorEvent)
Does anyone know why this is? It’s driving me crazy!
Thanks in advance.