Packageflash.net
Classpublic class NetGroup
InheritanceNetGroup Inheritance EventDispatcher Inheritance Object

Language version: ActionScript 3.0
Runtime version: AIR 2

Instances of the NetGroup class represent membership in an RTMFP group. Use this class to do the following:

In the client-side NetGroup class, the NetConnection dispatches the following events:

The info.group property of the event object contains a reference to the event source (the NetGroup). The NetGroup dispatches all other events. In the server-side NetGroup class, the NetGroup dispatches all events.

For information about using groups with peer-assisted networking, see Social Media Experiences with Flash Media and RTMFP, also by Tom Krcha.

For information about the technical details behind peer-assisted networking, see P2P on the Flash Platform with RTMFP by Adobe Computer Scientist Matthew Kaufman.

See also

flash.net.GroupSpecifier
flash.net.NetStream
flash.events.NetStatusEvent info.code values starting with "NetGroup."


Public Properties
 PropertyDefined by
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
  estimatedMemberCount : Number
[read-only] Specifies the estimated number of members of the group, based on local neighbor density and assuming an even distribution of group addresses.
NetGroup
  info : NetGroupInfo
[read-only] Returns a NetGroupInfo object whose properties provide Quality of Service statistics about this NetGroup's RTMFP peer-to-peer data transport.
NetGroup
  localCoverageFrom : String
[read-only] Specifies the start of the range of group addresses for which this node is the "nearest" and responsible.
NetGroup
  localCoverageTo : String
[read-only] Specifies the end of the range of group addresses for which this node is the "nearest" and responsible.
NetGroup
  neighborCount : Number
[read-only] Specifies the number of group members to which this node is directly connected.
NetGroup
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
  receiveMode : String
Specifies this node's routing receive mode as one of values in the NetGroupReceiveMode enum class.
NetGroup
  replicationStrategy : String
Specifies the object replication fetch strategy.
NetGroup
Public Methods
 MethodDefined by
  
NetGroup(connection:NetConnection, groupspec:String)
Constructs a NetGroup on the specified NetConnection object and joins it to the group specified by groupspec.
NetGroup
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event.
EventDispatcher
  
addHaveObjects(startIndex:Number, endIndex:Number):void
Adds objects from startIndex through endIndex, to the set of objects this node advertises to neighbors as objects for which it fulfills requests.
NetGroup
  
Manually adds a record specifying that peerID is a member of the group.
NetGroup
  
Manually adds a neighbor by immediately connecting directly to the specified peerID, which must already be in this group.
NetGroup
  
addWantObjects(startIndex:Number, endIndex:Number):void
Adds objects from startIndex through endIndex, to the set of objects to retrieve.
NetGroup
  
Disconnect from the group and close this NetGroup.
NetGroup
  
Converts a peerID to a group address suitable for use with the sendToNearest() method.
NetGroup
  
Denies a request received in a NetStatusEvent NetGroup.Replication.Request for an object previously advertised with addHaveObjects().
NetGroup
 Inherited
Dispatches an event into the event flow.
EventDispatcher
 Inherited
Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
EventDispatcher
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
  
post(message:Object):String
Sends a message to all members of a group.
NetGroup
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object.
EventDispatcher
  
removeHaveObjects(startIndex:Number, endIndex:Number):void
Removes objects from startIndex through endIndex, from the set of objects this node advertises to neighbors as objects for which it fulfills requests.
NetGroup
  
removeWantObjects(startIndex:Number, endIndex:Number):void
Removes objects from startIndex through endIndex, from the set of objects to retrieve.
NetGroup
  
Sends a message to all neighbors.
NetGroup
  
sendToNearest(message:Object, groupAddress:String):String
Sends a message to the neighbor (or local node) nearest to the specified group address.
NetGroup
  
sendToNeighbor(message:Object, sendMode:String):String
Sends a message to the neighbor specified by the sendMode parameter.
NetGroup
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
 Inherited
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type.
EventDispatcher
  
writeRequestedObject(requestID:int, object:Object):void
Satisfies the request as received by NetStatusEvent NetGroup.Replication.Request for an object previously advertised with the addHaveObjects() method.
NetGroup
Events
 EventSummaryDefined by
 Inherited [broadcast event] Dispatched when the Flash Player or AIR application gains operating system focus and becomes active.EventDispatcher
 Inherited [broadcast event] Dispatched when the Flash Player or AIR application operating loses system focus and is becoming inactive.EventDispatcher
   Dispatched when a NetGroup object is reporting its status or error condition.NetGroup
Property detail
estimatedMemberCountproperty
estimatedMemberCount:Number  [read-only]

Language version: ActionScript 3.0
Runtime version: AIR 2

Specifies the estimated number of members of the group, based on local neighbor density and assuming an even distribution of group addresses.

Implementation
    public function get estimatedMemberCount():Number

See also

infoproperty 
info:NetGroupInfo  [read-only]

Language version: ActionScript 3.0
Runtime version: AIR 2

Returns a NetGroupInfo object whose properties provide Quality of Service statistics about this NetGroup's RTMFP peer-to-peer data transport.

Implementation
    public function get info():NetGroupInfo

See also

localCoverageFromproperty 
localCoverageFrom:String  [read-only]

Language version: ActionScript 3.0
Runtime version: AIR 2

Specifies the start of the range of group addresses for which this node is the "nearest" and responsible. The range is specified in the increasing direction along the group address ring mod 2256.

Implementation
    public function get localCoverageFrom():String

See also

localCoverageToproperty 
localCoverageTo:String  [read-only]

Language version: ActionScript 3.0
Runtime version: AIR 2

Specifies the end of the range of group addresses for which this node is the "nearest" and responsible. The range is specified in the increasing direction along the group address ring mod 2256.

Implementation
    public function get localCoverageTo():String

See also

neighborCountproperty 
neighborCount:Number  [read-only]

Language version: ActionScript 3.0
Runtime version: AIR 2

Specifies the number of group members to which this node is directly connected.

Implementation
    public function get neighborCount():Number

See also

receiveModeproperty 
receiveMode:String  [read-write]

Language version: ActionScript 3.0
Runtime version: AIR 2

Specifies this node's routing receive mode as one of values in the NetGroupReceiveMode enum class.

Implementation
    public function get receiveMode():String
    public function set receiveMode(value:String):void

See also

replicationStrategyproperty 
replicationStrategy:String  [read-write]

Language version: ActionScript 3.0
Runtime version: AIR 2

Specifies the object replication fetch strategy. The value is one of the enumerated values in the NetGroupReplicationStrategy class.

Implementation
    public function get replicationStrategy():String
    public function set replicationStrategy(value:String):void

See also

Constructor detail
NetGroup()constructor
public function NetGroup(connection:NetConnection, groupspec:String)

Language version: ActionScript 3.0
Runtime version: AIR 2

Constructs a NetGroup on the specified NetConnection object and joins it to the group specified by groupspec.

In most cases, a groupspec has the potential for using the network uplink on the local system. When a NetStream or NetGroup object is constructed with a groupspec, Flash Player displays a Privacy Dialog. The dialog asks whether Flash Player can use the connection to share data with a user's peers. If the user clicks "Allow for this domain", the dialog is not displayed the next time the user connects to this application. If a user does not allow peer-assisted networking, all peer features within the group (posting, directed routing, and object replication, and multicast) are disabled. If permission is allowed, a NetStatusEvent is sent to the NetConnection's event listener with NetGroup.Connect.Success in the code property of the info object. If permission is denied, the code property is NetGroup.Connect.Rejected. Until a NetGroup.Connect.Success event is received, an exception is thrown if you try to call any method of the NetGroup object.

Note: When a client subscribes to a native-IP multicast stream, the security dialog is not displayed.

Parameters
connection:NetConnection — A NetConnection object.
 
groupspec:String — A string specifying the RTMFP peer-to-peer group to join, including its name, capabilities, restrictions, and the authorizations of this member.
     new NetGroup(myConnection, myGroupSpecifier.groupspecWithAuthorizations());
     

Throws
ArgumentError — The NetConnection instance is not connected.
 
Error — The groupspec is invalid.

See also

Method detail
addHaveObjects()method
public function addHaveObjects(startIndex:Number, endIndex:Number):void

Language version: ActionScript 3.0
Runtime version: AIR 2

Adds objects from startIndex through endIndex, to the set of objects this node advertises to neighbors as objects for which it fulfills requests. By default, the Have set is empty. Indices must be whole numbers from 0 through 9007199254740992.

For more information about object replication, see "Replicate an object within a group" in Flash Media Server Developer’s Guide.

This method sends a NetStatusEvent to the NetGroup's event listener with "NetGroup.Replication.Request" in the code property of the info object.

NOTE: Test for the NetGroup.Neighbor.Connect event before calling this method.

Parameters
startIndex:Number — The beginning of the range of object indices to add to the Have set.
 
endIndex:Number — The end of the range of object indices to add to the Have set.

Throws
RangeError — A number passed to this method is less than 0 or greater than 9007199254740992.

See also

addMemberHint()method 
public function addMemberHint(peerID:String):Boolean

Language version: ActionScript 3.0
Runtime version: AIR 2

Manually adds a record specifying that peerID is a member of the group. An immediate connection to it is attempted only if it is needed for the topology.

Parameters
peerID:String — The peerID to add to the set of potential neighbors.

Returns
Boolean — TRUE for success, FALSE for failure.

See also

addNeighbor()method 
public function addNeighbor(peerID:String):Boolean

Language version: ActionScript 3.0
Runtime version: AIR 2

Manually adds a neighbor by immediately connecting directly to the specified peerID, which must already be in this group. This direct connection may later be dropped if it is not needed for the topology.

Parameters
peerID:String — The peerID to which to immediately connect.

Returns
Boolean — TRUE for success, FALSE for failure.

See also

addWantObjects()method 
public function addWantObjects(startIndex:Number, endIndex:Number):void

Language version: ActionScript 3.0
Runtime version: AIR 2

Adds objects from startIndex through endIndex, to the set of objects to retrieve. Indices must be whole numbers from 0 through 9007199254740992. By default, the Want set is empty.

For more information about object replication, see "Replicate an object within a group" in Flash Media Server Developer’s Guide.

This method sends a NetStatusEvent to the NetGroup's event listener with NetGroup.Replication.Fetch.SendNotify in the info.code property. This event is followed by an NetGroup.Replication.Fetch.Failed or NetGroup.Replication.Fetch.Result event.

NOTE: Test for the NetGroup.Neighbor.Connect event before calling this method.

Parameters
startIndex:Number — The beginning of the range of object indices to add to the Want set.
 
endIndex:Number — The end of the range of object indices to add to the Want set.

Throws
RangeError — A number passed to this method is less than 0 or greater than 9007199254740992.

See also

close()method 
public function close():void

Language version: ActionScript 3.0
Runtime version: AIR 2

Disconnect from the group and close this NetGroup. This NetGroup is not usable after calling this method.

convertPeerIDToGroupAddress()method 
public function convertPeerIDToGroupAddress(peerID:String):String

Language version: ActionScript 3.0
Runtime version: AIR 2

Converts a peerID to a group address suitable for use with the sendToNearest() method.

Parameters
peerID:String — The peerID to convert.

Returns
String — The group address for the peerID.

See also

denyRequestedObject()method 
public function denyRequestedObject(requestID:int):void

Language version: ActionScript 3.0
Runtime version: AIR 2

Denies a request received in a NetStatusEvent NetGroup.Replication.Request for an object previously advertised with addHaveObjects(). The requestor can request this object again unless or until it is withdrawn from the Have set.

For more information about object replication, see "Replicate an object within a group" in Flash Media Server Developer’s Guide.

NOTE: Test for the NetGroup.Neighbor.Connect event before calling this method.

Parameters
requestID:int — The request identifier as given in the NetGroup.Replication.Request event.

See also

post()method 
public function post(message:Object):String

Language version: ActionScript 3.0
Runtime version: AIR 2

Sends a message to all members of a group. To call this method, the GroupSpecifier.postingEnabled property must be true in the groupspec passed to the NetGroup constructor. For more information, see "Post messages to a group" in Flash Media Server Developer’s Guide.

All messages must be unique. A message that is identical to one posted earlier might not be propagated. Use a sequence number to make messages unique.

Message delivery is not ordered. Message delivery is not guaranteed.

Messages are serialized in AMF. The message can be one of the following types: an Object, an int, a Number, or a String. The message cannot be a MovieClip.

This method sends a NetStatusEvent to the NetGroup's event listener with "NetGroup.Posting.Notify" in the info.code property. The "NetGroup.Posting.Notify" event is dispatched to the NetGroup on both the client and the server.

NOTE: Test for the NetGroup.Neighbor.Connect event before calling this method.

Parameters
message:Object — The message to send to all other members of the group.

Returns
String — The messageID of the message if posted, or null on error. The messageID is the hexadecmial of the SHA256 of the raw bytes of the serialization of the message.

See also


Example
This is a simple text chat application that uses peer-to-peer networking. The application connects over RTMFP to Flash Media Server. The server keeps the client applications' fingerprints and manages the peer group as clients connect. However, all data is sent between clients (peers) -- data is not sent back to the server.

When you run the application, you can enter any group name into the text input field. The GroupSpecifier class uses the name (along with any GroupSpecifier properties you've set) to create a string which is the perpetually unique name of the group. To connect another client to the group, that client must use the same group name. For example, if client A uses the group name "firstmesh", other clients that want to communicate with client A must also use the group name "firstmesh". If client B uses the group name "kite", it will connect successfully, but it will create a new group and won't be able to communicate with client A or anyone in the "firstmesh" group.

To run this example, add a Button, a Label, a TextInput, and a TextArea component to the Library in Flash Pro.




package  {

    import flash.display.Sprite;
    import flash.events.TextEvent;
    import flash.events.MouseEvent;
	import flash.events.NetStatusEvent;
	import fl.events.ComponentEvent;
	import fl.controls.Label;
	import fl.controls.Button;
	import fl.controls.TextInput;
	import fl.controls.TextArea;
	import flash.text.TextFieldAutoSize;
	import flash.net.*;

	public class NetGroupPostExample extends Sprite{

		private var connectButton:Button;
		private var disconnectButton:Button;
		private var groupNameText:TextInput;
		private var userNameText:TextInput;
		private var chatText:TextInput;
		private var statusLog:TextArea;
		private var groupLabel:Label;
		private var userLabel:Label;

		private var netConnection:NetConnection = null;
		private var netGroup:NetGroup = null;
		private var sequenceNumber:uint = 0;
		private var connected:Boolean = false;
		private var joinedGroup:Boolean = false;

		private const SERVER:String = "rtmfp://fms.example.com/someapp";

		public function NetGroupPostExample() {
			DoUI();
		}

		// Writes messages to the TextArea.
		private function StatusMessage(msg:Object):void{
			statusLog.text += msg;
			statusLog.verticalScrollPosition = statusLog.textHeight;
			statusLog.validateNow();
		}

		// Handles all NetStatusEvents for the NetConnection and the NetGroup.
		// This code includes cases it doesn't handle so you can see the cases
		// and their info objects for learning purposes.
		private function NetStatusHandler(e:NetStatusEvent):void{
			StatusMessage(e.info.code + "\n");
			switch(e.info.code){
				case "NetConnection.Connect.Success":
					connectButton.enabled = false;
					disconnectButton.enabled = true;
					OnConnect();
					break;

				case "NetConnection.Connect.Closed":
					OnDisconnect();
					break;

				case "NetGroup.Connect.Success": // e.info.group
					OnNetGroupConnect();
					break;

				case "NetGroup.Connect.Rejected": // e.info.group
				case "NetGroup.Connect.Failed": // e.info.group
					break;

				case "NetGroup.Posting.Notify": // e.info.message, e.info.messageID
					OnPosting(e.info.message);
					break;

				case "NetStream.MulticastStream.Reset":
				case "NetStream.Buffer.Full":
					break;

				case "NetGroup.SendTo.Notify": // e.info.message, e.info.from, e.info.fromLocal
				case "NetGroup.LocalCoverage.Notify": //
				case "NetGroup.Neighbor.Connect": // e.info.neighbor
				case "NetGroup.Neighbor.Disconnect": // e.info.neighbor
				case "NetGroup.MulticastStream.PublishNotify": // e.info.name
				case "NetGroup.MulticastStream.UnpublishNotify": // e.info.name
				case "NetGroup.Replication.Fetch.SendNotify": // e.info.index
				case "NetGroup.Replication.Fetch.Failed": // e.info.index
				case "NetGroup.Replication.Fetch.Result": // e.info.index, e.info.object
				case "NetGroup.Replication.Request": // e.info.index, e.info.requestID
				default:
					break;
				}
			}
		// Creates a NetConnection to Flash Media Server if the app isn't already connected
		// and if there's a group name in the TextInput field.
		private function DoConnect(e:MouseEvent):void{
			if(!connected && (groupNameText.length > 0)){
				StatusMessage("Connecting to \"" + SERVER + "\" ...\n");
				netConnection = new NetConnection();
				netConnection.addEventListener(NetStatusEvent.NET_STATUS, NetStatusHandler);
				// To connect to Flash Media Server, pass the server name.
				netConnection.connect(SERVER);
			}
			else
			{
				StatusMessage("Enter a group name");
			}
		}

		// Called in the "NetConnection.Connect.Success" case in the NetStatusEvent handler.
		private function OnConnect():void{

			StatusMessage("Connected\n");
			connected = true;

			// Create a GroupSpecifier object to pass to the NetGroup constructor.
			// The GroupSpecifier determines the properties of the group
			var groupSpecifier:GroupSpecifier;
			groupSpecifier = new GroupSpecifier("aslrexample/" + groupNameText.text);
			groupSpecifier.postingEnabled = true;
			groupSpecifier.serverChannelEnabled = true;

			netGroup = new NetGroup(netConnection, groupSpecifier.groupspecWithAuthorizations());
			netGroup.addEventListener(NetStatusEvent.NET_STATUS, NetStatusHandler);

			StatusMessage("Join \"" + groupSpecifier.groupspecWithAuthorizations() + "\"\n");

		}

		private function OnNetGroupConnect():void{
			joinedGroup = true;
		}

		private function DoDisconnect(e:MouseEvent):void{
			if(netConnection){
				netConnection.close();
			}
		}

		private function OnDisconnect():void{
			StatusMessage("Disconnected\n");
			netConnection = null;
			netGroup = null;
			connected = false;
			joinedGroup = false;
			connectButton.enabled = true;
			disconnectButton.enabled = false;
		}

		private function ClearChatText():void{
			chatText.text = "";
		}

		// Called when you the chatText field has focus and you press Enter.
		private function DoPost(e:ComponentEvent):void{
			if(joinedGroup){
				var message:Object = new Object;
				message.user = userNameText.text;
				message.text = chatText.text;
				message.sequence = sequenceNumber++;
				message.sender = netConnection.nearID;

				netGroup.post(message);
				StatusMessage("==> " + chatText.text + "\n");
			} else {
				StatusMessage("Click Connect before sending a chat message");
			}
			ClearChatText();
		}

		private function OnPosting(message:Object):void{
			StatusMessage("<" + message.user + "> " + message.text + "\n");
		}

		private function DoUI():void {

			groupLabel = new Label();
			groupLabel.move(20, 10);
			groupLabel.autoSize = TextFieldAutoSize.LEFT
			groupLabel.text = "Group name:"
			addChild(groupLabel);

			groupNameText = new TextInput();
			groupNameText.move(90, 10);
			groupNameText.text = "channel" + (int(Math.random() * 899) + 101);
			addChild(groupNameText);

        	connectButton = new Button();
			connectButton.addEventListener(MouseEvent.CLICK, DoConnect);
			connectButton.move(205, 10);
			connectButton.label = "Connect";
			addChild(connectButton);

			disconnectButton = new Button();
			disconnectButton.addEventListener(MouseEvent.CLICK, DoDisconnect);
			disconnectButton.move(310, 10);
			disconnectButton.label = "Disconnect";
			disconnectButton.enabled = false;
			addChild(disconnectButton);

			statusLog = new TextArea();
			statusLog.move(30, 38);
			statusLog.width = 360;
			statusLog.height = 215;
			statusLog.editable = false;
			addChild(statusLog);

			userLabel = new Label();
			userLabel.move(20, 270);
			userLabel.autoSize = TextFieldAutoSize.LEFT
			userLabel.text = "User name:"
			addChild(userLabel);

			userNameText = new TextInput();
			userNameText.move(80, 270);
			userNameText.text = "user " + int(Math.random() * 65536);
			addChild(userNameText);

			chatText = new TextInput();
			chatText.addEventListener(ComponentEvent.ENTER, DoPost);
			chatText.move(185, 270);
			chatText.maxChars = 255;
			chatText.width = 215;
			addChild(chatText);

		}

		public function onPlayStatus(info:Object):void {}
		public function onMetaData(info:Object):void {}
		public function onCuePoint(info:Object):void {}
		public function onTextData(info:Object):void {}

	}

}

removeHaveObjects()method 
public function removeHaveObjects(startIndex:Number, endIndex:Number):void

Language version: ActionScript 3.0
Runtime version: AIR 2

Removes objects from startIndex through endIndex, from the set of objects this node advertises to neighbors as objects for which it fulfills requests. Indices must be whole numbers from 0 through 9007199254740992.

For more information about object replication, see "Replicate an object within a group" in Flash Media Server Developer’s Guide.

NOTE: Test for the NetGroup.Neighbor.Connect event before calling this method.

Parameters
startIndex:Number — The beginning of the range of object indices to remove from the Have set.
 
endIndex:Number — The end of the range of object indices to remove from the Have set.

Throws
RangeError — A number passed to this method is less than 0 or greater than 9007199254740992.

See also

removeWantObjects()method 
public function removeWantObjects(startIndex:Number, endIndex:Number):void

Language version: ActionScript 3.0
Runtime version: AIR 2

Removes objects from startIndex through endIndex, from the set of objects to retrieve. Indices must be whole numbers from 0 through 9007199254740992.

For more information about object replication, see "Replicate an object within a group" in Flash Media Server Developer’s Guide.

NOTE: Test for the NetGroup.Neighbor.Connect event before calling this method.

Parameters
startIndex:Number — The beginning of the range of object indices to remove from the Want set.
 
endIndex:Number — The end of the range of object indices to remove from the Want set.

Throws
RangeError — A number passed to this method is less than 0 or greater than 9007199254740992.

See also

sendToAllNeighbors()method 
public function sendToAllNeighbors(message:Object):String

Language version: ActionScript 3.0
Runtime version: AIR 2

Sends a message to all neighbors. Returns NetGroupSendResult.SENT if at least one neighbor was selected.

For more information about routing messages, see "Route messages directly to a peer" in Flash Media Server Developer’s Guide.

When a node receives a message, a NetStatusEvent is sent to the NetGroup's event listener with NetGroup.SendTo.Notify in the code property of the info object.

NOTE: Test for the NetGroup.Neighbor.Connect event before calling this method.

Parameters
message:Object — The message to send.

Returns
String — A property of enumeration class NetGroupSendResult indicating the success or failure of the send.

See also

sendToNearest()method 
public function sendToNearest(message:Object, groupAddress:String):String

Language version: ActionScript 3.0
Runtime version: AIR 2

Sends a message to the neighbor (or local node) nearest to the specified group address. Considers neighbors from the entire ring. Returns NetGroupSendResult.SENT if the message was successfully sent toward its destination.

For more information about routing messages, see "Route messages directly to a peer" in Flash Media Server Developer’s Guide.

When a node receives a message, a NetStatusEvent is sent to the NetGroup's event listener with NetGroup.SendTo.Notify in the code property of the info object.

NOTE: Test for the NetGroup.Neighbor.Connect event before calling this method.

Parameters
message:Object — The message to send.
 
groupAddress:String — The group address toward which to route the message.

Returns
String — A property of enumeration class NetGroupSendResult indicating the success or failure of the send.

See also

sendToNeighbor()method 
public function sendToNeighbor(message:Object, sendMode:String):String

Language version: ActionScript 3.0
Runtime version: AIR 2

Sends a message to the neighbor specified by the sendMode parameter. Returns NetGroupSendResult.SENT if the message was successfully sent to the requested destination.

For more information about routing messages, see "Route messages directly to a peer" in Flash Media Server Developer’s Guide.

When a node receives a message, a NetStatusEvent is sent to the NetGroup's event listener with NetGroup.SendTo.Notify in the code property of the info object.

NOTE: Test for the NetGroup.Neighbor.Connect event before calling this method.

Parameters
message:Object — The message to send.
 
sendMode:String — A property of enumeration class NetGroupSendMode specifying the neighbor to which to send the message.

Returns
String — A property of enumeration class NetGroupSendResult indicating the success or failure of the send.

See also

writeRequestedObject()method 
public function writeRequestedObject(requestID:int, object:Object):void

Language version: ActionScript 3.0
Runtime version: AIR 2

Satisfies the request as received by NetStatusEvent NetGroup.Replication.Request for an object previously advertised with the addHaveObjects() method. The object can be any of the following: An Object, an int, a Number, and a String. The object cannot be a MovieClip.

For more information about object replication, see "Replicate an object within a group" in Flash Media Server Developer’s Guide.

NOTE: Test for the NetGroup.Neighbor.Connect event before calling this method.

Parameters
requestID:int — The request identifier as given in the NetGroup.Replication.Request event.
 
object:Object — The object corresponding to the index given in the NetGroup.Replication.Request event.

See also

Event detail
netStatusevent 
Event object type: flash.events.NetStatusEvent
NetStatusEvent.type property = flash.events.NetStatusEvent.NET_STATUS

Language version: ActionScript 3.0
Runtime version: 

Dispatched when a NetGroup object is reporting its status or error condition. The netStatus event contains an info property. The info property is an object that contains information about the event, such as whether a connection attempt succeeded or failed.

Defines the value of the type property of a netStatus event object.

This event has the following properties:

PropertyValue
bubblesfalse
cancelablefalse; there is no default behavior to cancel.
currentTargetThe object that is actively processing the Event object with an event listener.
infoAn object with properties that describe the object's status or error condition.
targetThe NetConnection or NetStream object reporting its status.

See also