PDA

View Full Version : [AS3] Published SWF Testing with SmartFox Help


Tyler1989
03-17-2009, 12:29 AM
Hi, I'm not entirely sure if this is the appropriate forum to be posting questions regarding SmartFoxServer but I've encountered a strange error....

I've been learning how to use smartfoxserver for about a week now and I've just been testing everything locally. The SFS is running in the background and the config file is configured to the best of my knowledge. Everything works fine when I run the flash game in Flash CS3 ( Test Movie, ctrl+enter ), it connects to the server, I had a friend also able to connect to the same server as well. Everything works fine in that scenario. But when I try to run the game by clicking on the published swf file in my file directory it doesn't seem to want to connect to smartfoxserver. It doesn't throw an error, or crash it just doesn't do anything. The onConnection event is never thrown. Does anyone have an idea on what the problem could be?

Here's my code... I'm using a dummy textfield for debugging, just outputting junk to figure out where along the process is. The first "something" is printed but nothing works after the connect call on the sfsclient object. Does that make sense? Thanks in advance!

// button click
function onServerClick(event:MouseEvent) : void
{
this.txtRooms.text = "something";
newClient.sfs.connect("192.168.0.187", 9339);
this.txtRooms.text = "something2";
//if(newClient.bConnected == true)
//{
this.mcTextBox.visible = true;
this.btnJoin.visible = true;
//}
}

connect event handler

// replace with return type to display status on screen
private function smartFox_onConnection(e:SFSEvent):void
{
refStage.txtRooms.text += "something else";
if(e.params.success)
{
refStage.txtServer.text = "Server Status: Online";
// replace w/ isconnected
bConnected = true;
}
else
{
//refStage.txtServer.text = "Server Status: Failed";
refStage.txtServer.text = e.params.error;
// replace w/ isconnected
bConnected = false;
}
}

Mayhew
04-16-2009, 06:41 PM
Been following you around, hoping you'd get your issue solved. I have me teh same problemo. I be disappointed no one's answered you yet.