SFS2X Api loadConfig in FlashDevelop?

Post here your questions about the Flash / Flex / Air API for SFS2X

Moderators: Lapo, Bax

Post Reply
Mitsu
Posts: 21
Joined: 19 Aug 2011, 07:17

SFS2X Api loadConfig in FlashDevelop?

Post by Mitsu »

Hi I'm trying to load a configuration file for an as3 project I have in flashdevelop. I was following this tut:

http://www.youtube.com/smartFoxServer/# ... B7Yfbain1M


For quick referrence here's the config.xml

Code: Select all

<SmartFoxConfig>
	<ip>127.0.0.1</ip>
	<port>5050</port>
	<zone>EMZProductions</zone>
	<debug>true</debug>
	<httpPort>8080</httpPort>
</SmartFoxConfig>

And it is in my /src folder.

Now the video says it's supposed to try a connection attempt when it loads but it doesn't seem to be doing that? I can get my SFSEvents to work if I using the connect function but yea |: I don't think it's loading my config in the first place

Any reasons why this is?



btw,

_sfs.loadConfig('config.xml')

is what have for loading it.
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Post by rjgtav »

Hi. Is the config.xml file on the same folder as the client swf file? Also, try using "" instead of ''
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Mitsu
Posts: 21
Joined: 19 Aug 2011, 07:17

Post by Mitsu »

Oh wow thanks, but won't this cause issues if I want to say put this game on my website?

Edit: '' and "" won't change anything, I moved the file to my /bin with my swf
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Post by rjgtav »

What kind of issues are you thinking in? Like acessing the config file? well, i'm pretty sure that you always can not use the loadConfig method and manually set the necessary params on the client, but that will also expose the connection params to any hacker, right?
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Mitsu
Posts: 21
Joined: 19 Aug 2011, 07:17

Post by Mitsu »

Well I assume if I were to ftp the swf onto my site and then test it it wouldn't be able to load my config.xml because I don't have it on the site?
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Post by rjgtav »

Yup. You have to also upload the config.xml to the folder where your swf is, in your website
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Mitsu
Posts: 21
Joined: 19 Aug 2011, 07:17

Post by Mitsu »

Wouldn't that expose it even more to people :S
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Post by rjgtav »

Thats what i said. But even if you store the ip, port etc on the client, people can also access it
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Mitsu
Posts: 21
Joined: 19 Aug 2011, 07:17

Post by Mitsu »

Well I'm having a new problem now.

Code: Select all

			if (e.params.success) {
				queueMessage(connectStatus, 4, "Connection Successfull\n");
				connectOnce = true;
				connected = true;
				var request:LoginRequest = LoginRequest('');
				_sfs.send(request);
			}

I'm trying to get a loginrequest like it showed on the server to log me in as a guest. But whenever I do that I get this error?

[Fault] exception, information=TypeError: Error #1034: Type Coercion failed: cannot convert "" to com.smartfoxserver.v2.requests.LoginRequest.
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Post by rjgtav »

Hi. You need to create a new Instance of a LoginRequest.

Like for example:

var request:LoginRequest = new LoginRequest("username", "password");

or you can simply use:

_sfs.send(new LoginRequest("username", "password");
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Mitsu
Posts: 21
Joined: 19 Aug 2011, 07:17

Post by Mitsu »

Okay one last question, why are private messages censored?

[Guest8]: test
[Private]Guest8: **** ****** *******

And how can I change that.
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Post by rjgtav »

Hi. You need to disable the world filter for the private messages. You can change this setting in the Zone configurator (don't forget to restart the server afterwards - not sure if you can change on the ZOne monitor).

if you have rooms that are already pre-configured in the zone, you also need to change this setting on them (if possible).
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Mitsu
Posts: 21
Joined: 19 Aug 2011, 07:17

Post by Mitsu »

Oh I just realized it's not displaying the msg for me privately :S

Any good tuts on chatrooms and stuff like that with flashdevelop/builder using the as3 api?

Edit: Disregard this, I'm a moron xD
Post Reply