Skip to main content
Participant
March 21, 2007
Question

How to send messages via shareobject in FMS

  • March 21, 2007
  • 4 replies
  • 435 views
How to send messages via shareobject in FMS

I need some codes.
I want to send some string messages via shareobject, the string messages can be retrieve in client.

Can you give me some codes? Thank you for your help..
/
    This topic is closed to new replies. Start a new post to keep the conversation going.

    4 replies

    March 23, 2007
    Peldi has written a great article on how to manage users coming and going. Very easy to read and follow, plus you can extend the UserManager to meet your specific needs.

    http://www.peldi.com/fmswiki/index.php?title=Building_a_User_Manager

    Shack
    he4330937Author
    Participant
    March 23, 2007
    Thanks for your comment.

    en....I want to do something..I will maintenance a users list in charroom.

    I write a function in main.asc file , client can get users list via call the function.

    I write some codes in application.onConnect
    when a user connect, it will add users list.

    In application.onDisconnect, when a user disconnect, it will remove from users list.

    My hope when a user disconnect, I send a message to shareobject. the shareobject is called in other clients.
    Other client can retrieve the remove user message, they will call the function to get new users list.

    It is my idea. Can you give me some codes for my idea?

    Thank you very much.


    March 23, 2007
    If you want to sync the user list amongst the clients, you'd be better of setting a property of the shared object, rather than sending a bunch of messages around. When you change a property of a shared object, the data updates automatically on all of the clients.
    March 21, 2007
    It's right there in the docs.....

    var my_nc:NetConnection = new NetConnection();
    my_nc.connect("rtmp://myServer.myDomain.com/appName/appInstance");
    var my_ns:NetStream = new NetStream(my_nc);
    my_ns.publish("slav", "live");
    my_ns.send("Fun", "this is a test"); //Fun is the handler name.

    The receiving client's script looks something like this:

    var my_nc:NetConnection = new NetConnection();
    my_nc.connect("rtmp://myServer.myDomain.com/appName");
    my_ns = new NetStream(my_nc);
    my_ns.play("slav", -1, -1);

    my_ns.Fun = function(str) { //Fun is the handler name.
    trace (str);
    }