Answered
FMS auto disconnects when using a class
I am trying to implement a very simple class that will create
an instance of the NetConnection object and connect to the FMS
server. However, the client will connect then immediately
disconnect when the swf is published. My code is as follows...
FLA Code:
import _includes.*;
var obj_conn:Conn = new Conn();
obj_conn.connect();
Conn.as Code:
class _includes.Conn
{
public function Conn()
{
}
public function connect()
{
var nc:NetConnection = new NetConnection();
nc.connect("rtmp://localhost/classtest");
}
}
Please note that the connection works fine if I just create a NetConnection variable on the FLA itself in the timeline. Any suggestions/help would be appriciated!
FLA Code:
import _includes.*;
var obj_conn:Conn = new Conn();
obj_conn.connect();
Conn.as Code:
class _includes.Conn
{
public function Conn()
{
}
public function connect()
{
var nc:NetConnection = new NetConnection();
nc.connect("rtmp://localhost/classtest");
}
}
Please note that the connection works fine if I just create a NetConnection variable on the FLA itself in the timeline. Any suggestions/help would be appriciated!