开发者

Can I re-use a Actionscript 3 NetConnection?

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 
    开发者_Python百科{
        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!


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜