我可以重复使用 Actionscript 3 NetConnection 吗?
这可能是一个菜鸟问题,但由于我是 Flash 和 AS3 的新手,所以它是...
我可以以某种方式重新使用 AS3 NetConnection 吗?
我正在尝试创建一个处理连接的 AMFPHP 类,以便每当我想要调用 AMFPHP 方法时都可以重新使用该初始连接。
这是迄今为止我的代码,
package com.utils
{
public class amfphp
{
private var gateway:String = "http://localhost/amfphp/gateway.php";
private var connection:NetConnection = new NetConnection;
private function con(gate:String, con:NetConnection):void {
//connect to the gateway file
con.connect(gate);
return con;
}
}
}
提前感谢!
this is probably a noob question, but since I am new to Flash and AS3, here it goes...
Can I somehow re-use a AS3 NetConnection?
I am trying to create a AMFPHP class, that handles the connection, so I can re-use that initial connection whenever I want to make a call to a AMFPHP method.
Here is my code thus far,
package com.utils
{
public class amfphp
{
private var gateway:String = "http://localhost/amfphp/gateway.php";
private var connection:NetConnection = new NetConnection;
private function con(gate:String, con:NetConnection):void {
//connect to the gateway file
con.connect(gate);
return con;
}
}
}
Thanx in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没错,你的解决方案是可行的。我说的一件小事是因为你说你是 as3 的新手。您的函数无法返回连接对象,因为返回值设置为 void。
一切顺利。
塔马斯
That's right, your solution is workable. One little thing what I say because you said you are are new to as3. Your function can't return with the connection object, because the return value is set to void.
All the best.
Tamas