1046:找不到类型或不是编译时常量:ServerSocketConnectEvent [英] 1046: Type was not found or was not a compile-time constant: ServerSocketConnectEvent

查看:105
本文介绍了1046:找不到类型或不是编译时常量:ServerSocketConnectEvent的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使Adobe AIR SocketServer类正常工作.当我从Adobe网站粘贴此代码时:

I am trying to get the adobe AIR SocketServer class to work. When I pasted in this code from the adobe website:

import flash.net.ServerSocket; 
import flash.events.ServerSocketConnectEvent; 

function onConnect(e:ServerSocketConnectEvent):void 
{ 
    var incomingSocket:Socket = e.socket; 
} 
var server:ServerSocket = new ServerSocket(); 
server.addEventListener(Event.CONNECT, onConnect); 
server.bind(8888); 

我收到一条错误消息,指出找不到SocketServerConnectEvent.但是,有一个import语句在该行的上方精确地导入了该类.我在这里想念什么?

I got the error saying that the SocketServerConnectEvent could not be found. However, there is an import statement importing precisely that class at the line above it. What am I missing here?

推荐答案

之所以发生这种情况,是因为在您启动Air应用程序时,它试图在普通的Flash Player中运行它,并且显然无法访问这些类.

This is happening because when you launch your Air app it is trying to run it in the normal flash player and it obviously doesn't have access to those classes.

有一篇关于它的文章让我看看是否可以找到它.好吧,找不到它.

There was an article about it let me see if I can find it. Well can't find it.

如果您从Flash(CS5等)运行它,则应该可以正常运行.在Flex Builder中,我认为您按了ctrl + f11.

If you run it from flash (cs5 etc) it should run fine. In flex builder I think you hit ctrl+f11.

我大部分时间都在使用Flash开发,但不确定在那儿怎么做.如果那是您所使用的,那么我上面所述的原因就是它正在发生的原因.(在我的盒子上确认)

I use flash develop most of the time and I am not sure how you would do it there. If that is what you use then the reason I stated above is why it is happening. (confirmed on my box)

这篇关于1046:找不到类型或不是编译时常量:ServerSocketConnectEvent的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆