Flex 共享对象崩溃

发布于 2024-12-01 15:30:48 字数 329 浏览 0 评论 0原文

我正在开发一个使用共享对象在我的服务器上存储信息的 Flex 项目。我不是 100% 确定如何做到这一点,所以我在查找教程并遇到了这段代码:

nc = new NetConnection();
nc.connect("rtmp://[website here]");
so = SharedObject.getRemote("ballPosition", nc.uri, false);
so.connect(nc);

但是当它到达第三行时,它崩溃了。遗憾的是,我不知道如何使用 Flex 调试器,我现在正在研究这一点,但我想我会将其发布在这里并希望得到最好的结果。提前致谢。

I am working on a flex project using sharedobjects to store information on my server. I am not 100% sure how to do this, so I was looking up tutorials and came across this bit of code:

nc = new NetConnection();
nc.connect("rtmp://[website here]");
so = SharedObject.getRemote("ballPosition", nc.uri, false);
so.connect(nc);

But when it gets to the 3rd line, it crashes. I don't know how to use the debugger for flex sadly enough, which I am looking into now, but I figured that I would post this here and hope for the best. Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

惟欲睡 2024-12-08 15:30:48

我开始将其作为评论发布,但很快就变得太长了。

您可能会收到错误,因为您没有连接到服务器。如果您已连接,那么您将从第二行返回 true。我会从那里开始。例如:

nc = new NetConnection();
var c = nc.connect("rtmp://[website here]");
trace(c);
so = SharedObject.getRemote("ballPosition", nc.uri, false);
so.connect(nc);

另外,您可以尝试将其包装在 try/catch 块中,因为这会给您带来错误,但不会杀死您的应用程序(因为您是调试新手)。

try {
    nc = new NetConnection();
    nc.connect("rtmp://[website here]");
    so = SharedObject.getRemote("ballPosition", nc.uri, false);
    so.connect(nc);
} catch(e:Error) {
    trace("my sweet error is:", e);
}

总而言之,调试非常棒,在某些情况下可以为您节省大量时间。祝你好运!

I started posting this as a comment, but it quickly got too long..

You may be getting the error because you're not connected to the server. If you're connected then you'll get a true returned from your second line. I'd start there. eg:

nc = new NetConnection();
var c = nc.connect("rtmp://[website here]");
trace(c);
so = SharedObject.getRemote("ballPosition", nc.uri, false);
so.connect(nc);

Also, you might try wrapping this in a try/catch block as that will give you the error, but won't kill your app (since you're new to debugging).

try {
    nc = new NetConnection();
    nc.connect("rtmp://[website here]");
    so = SharedObject.getRemote("ballPosition", nc.uri, false);
    so.connect(nc);
} catch(e:Error) {
    trace("my sweet error is:", e);
}

In all, debugging is simply awesome and can save you a lot of time in certain situations. good luck!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文