You don't need frames to view this website. Flash communication server. Flash mx xml socket server.
Home
Main Menu
Home
- - - - - - -
What is Palabre ?
Features
News
FAQ
Forum
DEMO
- - - - - - -
Downloads !
Browse SVN
- - - - - - -
Search
Contact Us
- - - - - - -
Sourceforge Project Page
Python
Links
Palabre on Facebook






Actionscript for Multiplayer games
 
Download Palabre Flash Xml Socket Server DOWNLOAD Download Palabre Flash Xml Socket Server FORUM Download Palabre Flash Xml Socket Server FAQ Download Palabre Flash Xml Socket Server WHAT IS IT
 



Using Palabre ? Coming here for Support ? Please consider making an (even small) donation :)
Palabre Forum  


::post new topic::
just starting, need help - 2006/10/01 00:44 ok, here is my code so far, I can connect to the server and make a room:

Code:

 onFrame (5) { var sample_socket:XMLSocket = new XMLSocket(); sample_socket.connect('localhost'2468); sample_socket.onConnect = function(status) {  if (status) {        _root.sample_socket.send('<connect nickname="test_'+random(30)+'" ></connect>');                _root.sample_socket.send('<join room="test" />');    conn_txt.text "yes connection successful";    stop();  } else {    conn_txt.text "no connection made";  } }; }



but now I want to do something noticable. I want the other client to see something I do with the first client. Just to make sure its working. However, I don't know how. Can you help me send something to the server that will show up on all clients windows, like a text string or a box moving, thanks.

Btw, I am loving this program so far, good job making it.
  reply | quote
Re:just starting, need help - 2006/10/02 13:13 Hi,


you may make a button with something like

xml.send('<msg toroom="test">Super message ! </msg>');

and add :

sample_socket.onXML(xml) {

conn_txt.text += xml;

}

but i'm not sure of the syntax here , you may check the PalabreFlash Clients FLA demo in the download section

Have fun
Célio Conort
Lonesome Palabre developper
  reply | quote
Re:just starting, need help - 2006/10/02 20:57 Well, i set it up to be like this:

Code:

 onFrame (5) { var sample_socket:XMLSocket = new XMLSocket(); sample_socket.connect('localhost'2468); sample_socket.onConnect = function(status) {  if (status) {               sample_socket.send('<connect nickname="test_'+random(30)+'" ></connect>');                sample_socket.send('<join room="test" />');                xml.send('<msg toroom="test">Super message ! </msg>');                sample_socket.onXML(xml);                    receive.text xml;                      conn_txt.text "yes connection successful";    stop();  } else {    conn_txt.text "no connection made";  } } ; }



I didn't make the button yet because I wanted to test it this way first. However, the return says only "[type Function]" (without the ""). I know it must have gotten that from the server because it returns nothing when the server isn't on. I am trying to solve the problem, but I thought I would offer this to you incase you have seen it before and can offer a quick answer :)
  reply | quote
Re:just starting, need help - 2006/10/02 21:30 No
You've got to write it the way I did :

sample_socket.onXML(xml) {
receive.text += xml;
}

And you have to define it before sending datas

So that everytime a client sends somethings it will be shown in "receive"

have fun !
Célio Conort
Lonesome Palabre developper
  reply | quote
Re:just starting, need help - 2006/10/02 21:53 ok, I just want to tell you that I am not using macromedia flash. Im using a cheaper program called swish. So far everything has been working. However, it says the code has an error if I don't put an ";" after onXML(xml). And the program wont run anything if it thinks there is an error. Anyway, perhaps having the ";" is messing up this code because it still returns [type Function].

Code:

  xml.send('<msg toroom="test">Super message </msg>');        sample_socket.onXML(xml);{        receive.text += xml;         }



Now, you say I need to define it? Doesn't this define it or is there something more I need to type:


x_socket.onXML(xml)

Anyway, thanks for your help so far, Im not experienced with scripting and especially sockets :P
  reply | quote
Re:just starting, need help - 2006/10/03 00:01 Ok, a roomate (math major) helped me with my code. He reorganized alot of it and here it is:

Code:

 function myOnXML(doc) {   var doc.firstChild;   Warning.text "I made it here, where is the XML node that should have been returned from the server!";   receive.text e.nodename;   //if (e != null && e.nodeName == "MESSAGE") {     //displayMessage(e.attributes.user, e.attributes.text);     //receive.text = e.attributes.text;   //} } onFrame (1) {     msgxml = new XML('<dummymsg toroom="test">Super duper message </dummymsg>');     x_socket = new XMLSocket();     x_socket.onXML myOnXML;     x_socket.onClose showWarning;     if (x_socket.connect('localhost'2468))     {         x_socket.send('<connect nickname="test_'+random(30)+'" ></connect>');                 x_socket.send('<join room="test" />');                 if(x_socket.send('<msg toroom="test">Super message </msg>'))         {             receive.text "Sent message.";         };              conn_txt.text "yes connection successful";          //stop();     } }



Anyway, The good news is that it deffinatly sends information to the server. In fact, your demo client recieves the message from our client perfectly. However, for some reason our script doesnt recieve the message. Any idea why?
  reply | quote
Re:just starting, need help - 2006/10/03 09:07 Hum,
the code is good
Obviously Swich does not support the same syntax as Flash, but with your code the result is the same.

The first part of the problem is that by default, messages sent to a room are not coming back to sender to avoid useless traffic, if you want it back just send :
<msg toroom="test" back="1">Message ! </msg>

The other problem, "Might" be that you are sending three informations without waiting.

the part with :
Code:

  x_socket.send('<connect nickname="test_'+random(30)+'" ></connect>');       x_socket.send('<join room="test" />'); x_socket.send('<msg toroom="test">Super message </msg>');


As all thoose "sends" are asynchronous and are happening in the same millisecond, you should wait to be connected to the server before sending the 'connect' node, then you should wait for the "<connect isok=1 />" node before joining a room and you should wait to be in the room before sending a message.

so the code might be :



Code:

  function myOnXML(doc) {   var doc.firstChild;   Warning.text "I made it here, where is the XML node that should have been returned from the server!";   receive.text e.nodename;   if(e.nodeName == 'connect' ) {     x_socket.send('<join room="test" />');   } else if(e.nodeName == 'joined' ) {     x_socket.send('<msg toroom="test" back="1">This is a test message </msg>');   } } function myOnConnect(result) {    if(result) {        Warning.text += 'connection ok';         x_socket.send('<connect nickname="test_'+random(30)+'" ></connect>');    } else {       Warning.text += 'connection failed';    }   } onFrame (1) {     x_socket = new XMLSocket();     x_socket.onXML myOnXML;     x_socket.onClose showWarning;     x_socket.onConnect myOnConnect;        x_socket.connect('localhost'2468); }




Hope i'm helping :)

Have fun !
Célio Conort
Lonesome Palabre developper
  reply | quote
Re:just starting, need help - 2006/10/04 14:14 thankyou for all your help. I really appreciate it! but i think the problem must be swish. It looks like I will have to buy flash one of these days, expencive hobby but maybe its worth it. :)
  reply | quote
::post new topic::
SORRY, website is currently mostly broken due to software changes on the server.
Hope to fix it soon ...

In the meantime you may still download palabre or use the forum