Packageyy.events
Classpublic class NetEvent
InheritanceNetEvent Inheritance flash.events.Event

网络通讯事件。包括网络广播,连接,断开等事件。



Public Properties
 PropertyDefined By
  eventData : Object
事件信息保存变量
NetEvent
Public Constants
 ConstantDefined By
  CLOSED : String = YY_NET_CLOSED
[static] 收到网络断开事件。点击关闭应用按钮的时候会触发,收到此消息2秒后,应用会被关闭。 事件信息格式说明: eventData.result: int类型 基于何种原因断开了连接,请参考错误代码。result=983064时表示点击了关闭应用按钮,即将断开连接;
NetEvent
  RECV : String = YY_RECV
[static] 消息接收事件。接受到消息的时候会触发此事件。 事件信息格式说明: eventData.data: String类型 接收到的数据。
NetEvent
Property Detail
eventDataproperty
public var eventData:Object

事件信息保存变量

Constant Detail
CLOSEDConstant
public static const CLOSED:String = YY_NET_CLOSED

收到网络断开事件。点击关闭应用按钮的时候会触发,收到此消息2秒后,应用会被关闭。

事件信息格式说明:

eventData.result: int类型 基于何种原因断开了连接,请参考错误代码。result=983064时表示点击了关闭应用按钮,即将断开连接;


Example
         使用示例:
         YY.instance.net.addEventListener(NetEvent.CLOSED,onClosed);
         
         function onClosed(evt:NetEvent)
         {
             trace("关闭原因:"+evt.eventData.result);
         }
         
         
RECVConstant 
public static const RECV:String = YY_RECV

消息接收事件。接受到消息的时候会触发此事件。

事件信息格式说明:

eventData.data: String类型 接收到的数据。


Example

         
         使用示例:
         YY.instance.net.addEventListener(NetEvent.RECV,onRecv);

         function onRecv(evt:NetEvent)
         {
            trace("收到消息"+evt.eventData.data);
         }