1 Reply Latest reply on Jul 8, 2010 12:32 AM by Michael Thornburgh

    [Question][CS5] Using .send() and a few other questions

    That-random-dude

      Hi guys over the past few days I've been researching Stratus in CS5 in the hope to be able to spawn some sort of multiplayer game from it. The main problem I have run into is using .send(), I can't figure out how to use the correctly. This is what I understood would work but it does not seem to register that anything has happened:

       

      var myString:String;

      function sendMsg (event:MouseEvent):void
      {
           myString = textInput.text;
           outgoingStream.send("msg", myString);
      }

       

      function msg (myMsg:String):void

      {

           myLog.text += myMsg;

      }

       

      Any help getting this to work would be greatly appreciated.

       

      Just a few small questions about Stratus that I would love answered:

      1. Is using .send() faster/more efficent then posting where a fraction of a second counts (Sending player positions) where there is 4-8 people?
      2. When using a NetStream with a GroupSpecifier attached how can I tell when a person has joined or left?

       

      Note: All questions are in regard to CS5, not Flash Builder as I'm not very aware if there are any differences in the coding.

        • 1. Re: [Question][CS5] Using .send() and a few other questions
          Michael Thornburgh Adobe Employee

          NetStream.send() should usually be faster than NetGroup.post(), especially when using 1:1 NetStreams (vs Group NetStreams).

           

          when groups are large, there's no passive way to tell when members join or leave.  however, for small groups (less than about 15 members), they will be "fully meshed", meaning every member has a direct connection to every other member.  when that's the case, you can see the NetGroup.Neighbor.Connect/Disconnect events on a NetGroup.  to receive those, you must create a NetGroup with the same groupspec as your NetStream and listen for NetStatusEvent.NET_STATUS events.

           

          your function "msg" must be a method on the subscribing NetStream's "client" object to receive NetStream.send()s from the publisher.

           

          this is all generic ActionScript stuff.  i don't know how to use Flash CS5 but this stuff should all be the same in Flash and Flash Builder.

           

          -mike