適用於 Adobe® Flash® Platform 的 ActionScript® 3.0 參考
首頁  |  隱藏套件和類別清單 |  套件  |  類別  |  新增內容  |  索引  |  附錄  |  為什麼顯示英文?
篩選: AIR 30.0 和更早版本, Flash Player 30.0 和更早版本, Flash Lite 4
Flex 4.6 和更早版本, Flash Pro CS6 和更早版本
隱藏篩選
flash.net 

NetGroup  - AS3

套件x

最上層
adobe.utils
air.desktop
air.net
air.update
air.update.events
coldfusion.air
coldfusion.air.errors
coldfusion.air.events
coldfusion.service
coldfusion.service.events
coldfusion.service.mxml
com.adobe.acm.solutions.authoring.domain.extensions
com.adobe.acm.solutions.ccr.domain.extensions
com.adobe.consulting.pst.vo
com.adobe.dct.component
com.adobe.dct.component.datadictionary
com.adobe.dct.component.datadictionaryElement
com.adobe.dct.component.dataElementsPanel
com.adobe.dct.component.toolbars
com.adobe.dct.event
com.adobe.dct.exp
com.adobe.dct.model
com.adobe.dct.service
com.adobe.dct.service.provider
com.adobe.dct.transfer
com.adobe.dct.util
com.adobe.dct.view
com.adobe.ep.taskmanagement.domain
com.adobe.ep.taskmanagement.event
com.adobe.ep.taskmanagement.filter
com.adobe.ep.taskmanagement.services
com.adobe.ep.taskmanagement.util
com.adobe.ep.ux.attachmentlist.component
com.adobe.ep.ux.attachmentlist.domain
com.adobe.ep.ux.attachmentlist.domain.events
com.adobe.ep.ux.attachmentlist.domain.renderers
com.adobe.ep.ux.attachmentlist.skin
com.adobe.ep.ux.attachmentlist.skin.renderers
com.adobe.ep.ux.content.event
com.adobe.ep.ux.content.factory
com.adobe.ep.ux.content.handlers
com.adobe.ep.ux.content.managers
com.adobe.ep.ux.content.model.asset
com.adobe.ep.ux.content.model.preview
com.adobe.ep.ux.content.model.relation
com.adobe.ep.ux.content.model.search
com.adobe.ep.ux.content.model.toolbar
com.adobe.ep.ux.content.search
com.adobe.ep.ux.content.services
com.adobe.ep.ux.content.services.load
com.adobe.ep.ux.content.services.permissions
com.adobe.ep.ux.content.services.preview
com.adobe.ep.ux.content.services.providers
com.adobe.ep.ux.content.services.query
com.adobe.ep.ux.content.services.relationships
com.adobe.ep.ux.content.services.search.lccontent
com.adobe.ep.ux.content.services.version
com.adobe.ep.ux.content.view
com.adobe.ep.ux.content.view.components.activate
com.adobe.ep.ux.content.view.components.grid
com.adobe.ep.ux.content.view.components.grid.hover
com.adobe.ep.ux.content.view.components.grid.hover.component
com.adobe.ep.ux.content.view.components.grid.renderers
com.adobe.ep.ux.content.view.components.relationships
com.adobe.ep.ux.content.view.components.review
com.adobe.ep.ux.content.view.components.search.renderers
com.adobe.ep.ux.content.view.components.searchpod
com.adobe.ep.ux.content.view.components.toolbar
com.adobe.ep.ux.content.view.components.toolbar.controlRenderers
com.adobe.ep.ux.content.view.components.version
com.adobe.ep.ux.documentsubmit.component
com.adobe.ep.ux.documentsubmit.domain
com.adobe.ep.ux.documentsubmit.skin
com.adobe.ep.ux.taskaction.component
com.adobe.ep.ux.taskaction.domain
com.adobe.ep.ux.taskaction.domain.events
com.adobe.ep.ux.taskaction.skin
com.adobe.ep.ux.taskdetails.component
com.adobe.ep.ux.taskdetails.domain
com.adobe.ep.ux.taskdetails.skin
com.adobe.ep.ux.tasklist.component
com.adobe.ep.ux.tasklist.domain
com.adobe.ep.ux.tasklist.skin
com.adobe.ep.ux.webdocumentviewer.domain
com.adobe.exm.expression
com.adobe.exm.expression.error
com.adobe.exm.expression.event
com.adobe.exm.expression.impl
com.adobe.fiber.runtime.lib
com.adobe.fiber.services
com.adobe.fiber.services.wrapper
com.adobe.fiber.styles
com.adobe.fiber.util
com.adobe.fiber.valueobjects
com.adobe.gravity.binding
com.adobe.gravity.context
com.adobe.gravity.flex.bundleloader
com.adobe.gravity.flex.progress
com.adobe.gravity.flex.serviceloader
com.adobe.gravity.framework
com.adobe.gravity.init
com.adobe.gravity.service.bundleloader
com.adobe.gravity.service.logging
com.adobe.gravity.service.manifest
com.adobe.gravity.service.progress
com.adobe.gravity.tracker
com.adobe.gravity.ui
com.adobe.gravity.utility
com.adobe.gravity.utility.async
com.adobe.gravity.utility.error
com.adobe.gravity.utility.events
com.adobe.gravity.utility.factory
com.adobe.gravity.utility.flex.async
com.adobe.gravity.utility.logging
com.adobe.gravity.utility.message
com.adobe.gravity.utility.sequence
com.adobe.gravity.utility.url
com.adobe.guides.control
com.adobe.guides.domain
com.adobe.guides.i18n
com.adobe.guides.spark.components.skins
com.adobe.guides.spark.components.skins.mx
com.adobe.guides.spark.headers.components
com.adobe.guides.spark.headers.skins
com.adobe.guides.spark.layouts.components
com.adobe.guides.spark.layouts.skins
com.adobe.guides.spark.navigators.components
com.adobe.guides.spark.navigators.renderers
com.adobe.guides.spark.navigators.skins
com.adobe.guides.spark.util
com.adobe.guides.spark.wrappers.components
com.adobe.guides.spark.wrappers.skins
com.adobe.guides.submit
com.adobe.icc.dc.domain
com.adobe.icc.dc.domain.factory
com.adobe.icc.editors.events
com.adobe.icc.editors.handlers
com.adobe.icc.editors.managers
com.adobe.icc.editors.model
com.adobe.icc.editors.model.config
com.adobe.icc.editors.model.el
com.adobe.icc.editors.model.el.operands
com.adobe.icc.editors.model.el.operators
com.adobe.icc.enum
com.adobe.icc.external.dc
com.adobe.icc.obj
com.adobe.icc.services
com.adobe.icc.services.category
com.adobe.icc.services.config
com.adobe.icc.services.download
com.adobe.icc.services.export
com.adobe.icc.services.external
com.adobe.icc.services.formbridge
com.adobe.icc.services.fragmentlayout
com.adobe.icc.services.layout
com.adobe.icc.services.letter
com.adobe.icc.services.locator
com.adobe.icc.services.module
com.adobe.icc.services.render
com.adobe.icc.services.submit
com.adobe.icc.services.user
com.adobe.icc.token
com.adobe.icc.vo
com.adobe.icc.vo.render
com.adobe.icomm.assetplacement.controller
com.adobe.icomm.assetplacement.controller.utils
com.adobe.icomm.assetplacement.data
com.adobe.icomm.assetplacement.model
com.adobe.livecycle.assetmanager.client
com.adobe.livecycle.assetmanager.client.event
com.adobe.livecycle.assetmanager.client.handler
com.adobe.livecycle.assetmanager.client.managers
com.adobe.livecycle.assetmanager.client.model
com.adobe.livecycle.assetmanager.client.model.cms
com.adobe.livecycle.assetmanager.client.service
com.adobe.livecycle.assetmanager.client.service.search
com.adobe.livecycle.assetmanager.client.service.search.cms
com.adobe.livecycle.assetmanager.client.utils
com.adobe.livecycle.content
com.adobe.livecycle.rca.model
com.adobe.livecycle.rca.model.constant
com.adobe.livecycle.rca.model.document
com.adobe.livecycle.rca.model.participant
com.adobe.livecycle.rca.model.reminder
com.adobe.livecycle.rca.model.stage
com.adobe.livecycle.rca.service
com.adobe.livecycle.rca.service.core
com.adobe.livecycle.rca.service.core.delegate
com.adobe.livecycle.rca.service.process
com.adobe.livecycle.rca.service.process.delegate
com.adobe.livecycle.rca.token
com.adobe.livecycle.ria.security.api
com.adobe.livecycle.ria.security.service
com.adobe.mosaic.layouts
com.adobe.mosaic.layouts.dragAndDrop
com.adobe.mosaic.layouts.interfaces
com.adobe.mosaic.mxml
com.adobe.mosaic.om.constants
com.adobe.mosaic.om.events
com.adobe.mosaic.om.impl
com.adobe.mosaic.om.interfaces
com.adobe.mosaic.skinning
com.adobe.mosaic.sparklib.editors
com.adobe.mosaic.sparklib.optionMenu
com.adobe.mosaic.sparklib.scrollableMenu
com.adobe.mosaic.sparklib.scrollableMenu.skins
com.adobe.mosaic.sparklib.tabLayout
com.adobe.mosaic.sparklib.tabLayout.events
com.adobe.mosaic.sparklib.tabLayout.layouts
com.adobe.mosaic.sparklib.tabLayout.skins
com.adobe.mosaic.sparklib.text
com.adobe.mosaic.sparklib.util
com.adobe.solutions.acm.authoring.presentation
com.adobe.solutions.acm.authoring.presentation.actionbar
com.adobe.solutions.acm.authoring.presentation.common
com.adobe.solutions.acm.authoring.presentation.events
com.adobe.solutions.acm.authoring.presentation.fragment
com.adobe.solutions.acm.authoring.presentation.letter
com.adobe.solutions.acm.authoring.presentation.letter.data
com.adobe.solutions.acm.authoring.presentation.preview
com.adobe.solutions.acm.authoring.presentation.rte
com.adobe.solutions.acm.ccr.presentation
com.adobe.solutions.acm.ccr.presentation.contentcapture
com.adobe.solutions.acm.ccr.presentation.contentcapture.events
com.adobe.solutions.acm.ccr.presentation.contentcapture.preview
com.adobe.solutions.acm.ccr.presentation.datacapture
com.adobe.solutions.acm.ccr.presentation.datacapture.renderers
com.adobe.solutions.acm.ccr.presentation.pdf
com.adobe.solutions.exm
com.adobe.solutions.exm.authoring
com.adobe.solutions.exm.authoring.components.controls
com.adobe.solutions.exm.authoring.components.toolbars
com.adobe.solutions.exm.authoring.domain
com.adobe.solutions.exm.authoring.domain.expression
com.adobe.solutions.exm.authoring.domain.impl
com.adobe.solutions.exm.authoring.domain.method
com.adobe.solutions.exm.authoring.domain.variable
com.adobe.solutions.exm.authoring.enum
com.adobe.solutions.exm.authoring.events
com.adobe.solutions.exm.authoring.model
com.adobe.solutions.exm.authoring.renderer
com.adobe.solutions.exm.authoring.view
com.adobe.solutions.exm.expression
com.adobe.solutions.exm.impl
com.adobe.solutions.exm.impl.method
com.adobe.solutions.exm.method
com.adobe.solutions.exm.mock
com.adobe.solutions.exm.mock.method
com.adobe.solutions.exm.runtime
com.adobe.solutions.exm.runtime.impl
com.adobe.solutions.exm.variable
com.adobe.solutions.prm.constant
com.adobe.solutions.prm.domain
com.adobe.solutions.prm.domain.factory
com.adobe.solutions.prm.domain.impl
com.adobe.solutions.prm.domain.manager
com.adobe.solutions.prm.presentation.asset
com.adobe.solutions.prm.presentation.constant
com.adobe.solutions.prm.presentation.document
com.adobe.solutions.prm.presentation.event
com.adobe.solutions.prm.presentation.file
com.adobe.solutions.prm.presentation.project
com.adobe.solutions.prm.presentation.team
com.adobe.solutions.prm.presentation.util
com.adobe.solutions.prm.service
com.adobe.solutions.prm.services.impl
com.adobe.solutions.prm.vo
com.adobe.solutions.rca.constant
com.adobe.solutions.rca.domain
com.adobe.solutions.rca.domain.common
com.adobe.solutions.rca.domain.factory
com.adobe.solutions.rca.domain.impl
com.adobe.solutions.rca.domain.impl.manager
com.adobe.solutions.rca.domain.manager
com.adobe.solutions.rca.presentation
com.adobe.solutions.rca.presentation.comment
com.adobe.solutions.rca.presentation.constant
com.adobe.solutions.rca.presentation.event
com.adobe.solutions.rca.presentation.gantt
com.adobe.solutions.rca.presentation.gantt.ruler
com.adobe.solutions.rca.presentation.template
com.adobe.solutions.rca.presentation.template.audit
com.adobe.solutions.rca.presentation.template.definition
com.adobe.solutions.rca.presentation.template.documents
com.adobe.solutions.rca.presentation.template.stages
com.adobe.solutions.rca.presentation.util
com.adobe.solutions.rca.service
com.adobe.solutions.rca.services.impl
com.adobe.solutions.rca.vo
com.adobe.solutions.rca.vo.um
com.adobe.viewsource
fl.accessibility
fl.containers
fl.controls
fl.controls.dataGridClasses
fl.controls.listClasses
fl.controls.progressBarClasses
fl.core
fl.data
fl.display
fl.events
fl.ik
fl.lang
fl.livepreview
fl.managers
fl.motion
fl.motion.easing
fl.rsl
fl.text
fl.transitions
fl.transitions.easing
fl.video
flash.accessibility
flash.concurrent
flash.crypto
flash.data
flash.desktop
flash.display
flash.display3D
flash.display3D.textures
flash.errors
flash.events
flash.external
flash.filesystem
flash.filters
flash.geom
flash.globalization
flash.html
flash.media
flash.net
flash.net.dns
flash.net.drm
flash.notifications
flash.permissions
flash.printing
flash.profiler
flash.sampler
flash.security
flash.sensors
flash.system
flash.text
flash.text.engine
flash.text.ime
flash.ui
flash.utils
flash.xml
flashx.textLayout
flashx.textLayout.compose
flashx.textLayout.container
flashx.textLayout.conversion
flashx.textLayout.edit
flashx.textLayout.elements
flashx.textLayout.events
flashx.textLayout.factory
flashx.textLayout.formats
flashx.textLayout.operations
flashx.textLayout.utils
flashx.undo
ga.controls
ga.layouts
ga.model
ga.uiComponents
ga.util
ga.views
ga.wrappers
lc.foundation
lc.foundation.domain
lc.foundation.events
lc.foundation.ui
lc.foundation.util
lc.preloader
lc.procmgmt
lc.procmgmt.commands
lc.procmgmt.domain
lc.procmgmt.events
lc.procmgmt.formbridge
lc.procmgmt.impl
lc.procmgmt.ui.attachments
lc.procmgmt.ui.controls
lc.procmgmt.ui.controls.card
lc.procmgmt.ui.controls.renderer
lc.procmgmt.ui.help
lc.procmgmt.ui.layout
lc.procmgmt.ui.presentationmodel
lc.procmgmt.ui.process
lc.procmgmt.ui.search
lc.procmgmt.ui.startpoint
lc.procmgmt.ui.task
lc.procmgmt.ui.task.form
lc.procmgmt.ui.task.form.commands
lc.procmgmt.ui.tracking
mx.accessibility
mx.automation
mx.automation.air
mx.automation.delegates
mx.automation.delegates.advancedDataGrid
mx.automation.delegates.charts
mx.automation.delegates.containers
mx.automation.delegates.controls
mx.automation.delegates.controls.dataGridClasses
mx.automation.delegates.controls.fileSystemClasses
mx.automation.delegates.core
mx.automation.delegates.flashflexkit
mx.automation.events
mx.binding
mx.binding.utils
mx.charts
mx.charts.chartClasses
mx.charts.effects
mx.charts.effects.effectClasses
mx.charts.events
mx.charts.renderers
mx.charts.series
mx.charts.series.items
mx.charts.series.renderData
mx.charts.styles
mx.collections
mx.collections.errors
mx.containers
mx.containers.accordionClasses
mx.containers.dividedBoxClasses
mx.containers.errors
mx.containers.utilityClasses
mx.controls
mx.controls.advancedDataGridClasses
mx.controls.dataGridClasses
mx.controls.listClasses
mx.controls.menuClasses
mx.controls.olapDataGridClasses
mx.controls.scrollClasses
mx.controls.sliderClasses
mx.controls.textClasses
mx.controls.treeClasses
mx.controls.videoClasses
mx.core
mx.core.windowClasses
mx.data
mx.data.crypto
mx.data.errors
mx.data.events
mx.data.messages
mx.data.mxml
mx.data.offline.errors
mx.data.utils
mx.effects
mx.effects.easing
mx.effects.effectClasses
mx.events
mx.filters
mx.flash
mx.formatters
mx.geom
mx.graphics
mx.graphics.codec
mx.graphics.shaderClasses
mx.logging
mx.logging.errors
mx.logging.targets
mx.managers
mx.messaging
mx.messaging.channels
mx.messaging.config
mx.messaging.errors
mx.messaging.events
mx.messaging.management
mx.messaging.messages
mx.modules
mx.netmon
mx.olap
mx.olap.aggregators
mx.preloaders
mx.printing
mx.resources
mx.rpc
mx.rpc.events
mx.rpc.http
mx.rpc.http.mxml
mx.rpc.livecycle
mx.rpc.mxml
mx.rpc.remoting
mx.rpc.remoting.mxml
mx.rpc.soap
mx.rpc.soap.mxml
mx.rpc.wsdl
mx.rpc.xml
mx.skins
mx.skins.halo
mx.skins.spark
mx.skins.wireframe
mx.skins.wireframe.windowChrome
mx.states
mx.styles
mx.utils
mx.validators
org.osmf.containers
org.osmf.display
org.osmf.elements
org.osmf.events
org.osmf.layout
org.osmf.logging
org.osmf.media
org.osmf.metadata
org.osmf.net
org.osmf.net.dvr
org.osmf.net.httpstreaming
org.osmf.net.metrics
org.osmf.net.qos
org.osmf.net.rtmpstreaming
org.osmf.net.rules
org.osmf.traits
org.osmf.utils
spark.accessibility
spark.automation.delegates
spark.automation.delegates.components
spark.automation.delegates.components.gridClasses
spark.automation.delegates.components.mediaClasses
spark.automation.delegates.components.supportClasses
spark.automation.delegates.skins.spark
spark.automation.events
spark.collections
spark.components
spark.components.calendarClasses
spark.components.gridClasses
spark.components.mediaClasses
spark.components.supportClasses
spark.components.windowClasses
spark.core
spark.effects
spark.effects.animation
spark.effects.easing
spark.effects.interpolation
spark.effects.supportClasses
spark.events
spark.filters
spark.formatters
spark.formatters.supportClasses
spark.globalization
spark.globalization.supportClasses
spark.layouts
spark.layouts.supportClasses
spark.managers
spark.modules
spark.preloaders
spark.primitives
spark.primitives.supportClasses
spark.skins
spark.skins.mobile
spark.skins.mobile.supportClasses
spark.skins.spark
spark.skins.spark.mediaClasses.fullScreen
spark.skins.spark.mediaClasses.normal
spark.skins.spark.windowChrome
spark.skins.wireframe
spark.skins.wireframe.mediaClasses
spark.skins.wireframe.mediaClasses.fullScreen
spark.transitions
spark.utils
spark.validators
spark.validators.supportClasses
xd.core.axm.enterprise.view.components
xd.core.axm.enterprise.view.skins
xd.core.axm.view.components
xd.core.axm.view.components.support

語言元素

全域常數
全域函數
運算子
陳述式、關鍵字和指令
特殊類型

附錄

新增內容
編譯器錯誤
編譯器警告
執行階段錯誤
移轉至 ActionScript 3
支援的字元集
僅限 MXML 標籤
移動 XML 元素
Timed Text 標籤
不建議元素清單
AccessibilityImplementation 常數
如何使用 ActionScript 範例
法律聲明
套件flash.net
類別public class NetGroup
繼承NetGroup Inheritance EventDispatcher Inheritance Object

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10.1, AIR 2

NetGroup 類別的實體代表 RTMFP 群組的成員資格。使用此類別可執行下列動作:
  • 監控服務品質info 屬性包含 NetGroupInfo 物件,而該物件的屬性會提供 QoS 統計資料給此群組。
  • 發表。呼叫 post() 以便對群組的所有成員廣播 ActionScript 訊息。
  • 直接路由。呼叫 sendToNearest()sendToNeighbor()sendToAllNeighbors(),以傳送簡短資料訊息給對等式群組的特定成員。來源與目標不需要具有直接的連線。
  • 物件複寫。呼叫 addHaveObjects()removeHaveObjects()addWantObjects()removeWantObjects()writeRequestedObject()denyRequestedObject(),將較大的資料分割成片段,並將它複寫到端對端群組中的所有群組。

在用戶端 NetGroup 類別中,NetConnection 會傳送下列事件:

  • NetGroup.Connect.Success
  • NetGroup.Connect.Failed
  • NetGroup.Connect.Rejected

事件物件的 info.group 屬性包含事件來源的參照 (NetGroup)。NetGroup 會傳送所有其他事件。在伺服器端 NetGroup 類別中,NetGroup 會傳送所有事件。

如需有關透過對等協助網路使用群組的詳細資訊,請參閱 Social Media Experiences with Flash Media and RTMFP (作者也是 Tom Krcha)。

如需有關對等協助網路技術的詳細資訊,請參閱 P2P on the Flash Platform with RTMFP (作者為 Adobe 電腦科學家 Matthew Kaufman)。

檢視範例

相關 API 元素



公用屬性
 屬性定義自
 Inheritedconstructor : Object
類別物件的參照或是特定物件實體的建構函數。
Object
  estimatedMemberCount : Number
[唯讀] 根據本機鄰近節點的密度,並假設群組位址平均分佈,指定群組成員的估計數目。
NetGroup
  info : NetGroupInfo
[唯讀] 傳回 NetGroupInfo 物件,其屬性提供與此 NetGroup 的 RTMFP 對等式資料傳輸有關的服務品質統計資料。
NetGroup
  localCoverageFrom : String
[唯讀] 指定此節點「最接近」且負責的群組位址範圍開始位置。
NetGroup
  localCoverageTo : String
[唯讀] 指定此節點「最接近」且負責的群組位址範圍結束位置。
NetGroup
  neighborCount : Number
[唯讀] 指定此節點直接連接的群組成員數目。
NetGroup
  receiveMode : String
將此節點的路由接收模式指定為 NetGroupReceiveMode enum 類別中的其中一個值。
NetGroup
  replicationStrategy : String
指定物件複寫取得策略。
NetGroup
公用方法
 方法定義自
  
NetGroup(connection:NetConnection, groupspec:String)
在指定的 NetConnection 物件上建構 NetGroup,並且將其加入到 groupspec 指定的群組。
NetGroup
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
會在 EventDispatcher 物件註冊事件偵聽程式,以便讓偵聽程式收到事件的通知。
EventDispatcher
  
addHaveObjects(startIndex:Number, endIndex:Number):void
將 startIndex 至 endIndex 的物件新增到物件集,此節點會向滿足要求的鄰近節點 (做為物件) 通告此物件集。
NetGroup
  
手動加入指定 peerID 為群組成員的記錄。
NetGroup
  
立即直接連線到指定的 peerID,以手動加入鄰近節點,而且這個 peerID 必須已經在這個群組中。
NetGroup
  
addWantObjects(startIndex:Number, endIndex:Number):void
將 startIndex 到 endIndex 之間的物件新增到要擷取的物件集。
NetGroup
  
中斷群組的連線,並關閉這個 NetGroup。
NetGroup
  
將 peerID 轉換為適合搭配 sendToNearest() 方法使用的群組位址。
NetGroup
  
對於之前利用 addHaveObjects() 宣告的物件,拒絕在 NetStatusEvent NetGroup.Replication.Request 接收的要求。
NetGroup
 Inherited
會將事件傳送到事件流程。
EventDispatcher
 Inherited
會檢查 EventDispatcher 物件是否有對特定的事件類型註冊偵聽程式。
EventDispatcher
 Inherited
指出物件是否有已定義的指定屬性。
Object
 Inherited
指出 Object 類別的實體是否位於指定為參數的物件原型鏈中。
Object
  
post(message:Object):String
傳送訊息到群組的所有成員。
NetGroup
 Inherited
指出指定的屬性是否存在,以及是否可列舉。
Object
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
會從 EventDispatcher 物件移除偵聽程式。
EventDispatcher
  
removeHaveObjects(startIndex:Number, endIndex:Number):void
將 startIndex 至 endIndex 的物件從物件集移除,此節點會向滿足要求的鄰近節點 (做為物件) 通告此物件集。
NetGroup
  
removeWantObjects(startIndex:Number, endIndex:Number):void
將 startIndex 到 endIndex 之間的物件從要擷取的物件集中移除。
NetGroup
  
傳送訊息到所有的鄰近節點。
NetGroup
  
sendToNearest(message:Object, groupAddress:String):String
傳送訊息到距離指定群組位址最近的鄰近節點 (或本機節點)。
NetGroup
  
sendToNeighbor(message:Object, sendMode:String):String
傳送訊息到 sendMode 參數指定的鄰近節點。
NetGroup
 Inherited
為迴圈作業設定動態屬性的可用性。
Object
 Inherited
傳回代表此物件的字串,根據地區特定慣例進行格式化。
Object
 Inherited
會傳回指定之物件的字串形式。
Object
 Inherited
會傳回指定之物件的基本值。
Object
 Inherited
檢查此 EventDispatcher 物件是否已註冊事件偵聽程式,或者此物件的任何祖系已為特定事件類型註冊事件偵聽程式。
EventDispatcher
  
writeRequestedObject(requestID:int, object:Object):void
對於之前利用 addHaveObjects() 方法宣告的物件,滿足 NetStatusEvent NetGroup.Replication.Request 接收的要求。
NetGroup
事件
 事件 摘要 定義自
 Inherited[廣播事件] 當 Flash Player 或 AIR 應用程式取得作業系統焦點並成為作用中時傳送。EventDispatcher
 Inherited[廣播事件] 當 Flash Player 或 AIR 應用程式失去作業系統焦點並成為非作用中時傳送。EventDispatcher
  在 NetGroup 物件回報其狀態或錯誤情況時傳送。NetGroup
屬性詳細資訊

estimatedMemberCount

屬性
estimatedMemberCount:Number  [唯讀]

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10.1, AIR 2

根據本機鄰近節點的密度,並假設群組位址平均分佈,指定群組成員的估計數目。



實作
    public function get estimatedMemberCount():Number

相關 API 元素

info

屬性 
info:NetGroupInfo  [唯讀]

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10.1, AIR 2

傳回 NetGroupInfo 物件,其屬性提供與此 NetGroup 的 RTMFP 對等式資料傳輸有關的服務品質統計資料。



實作
    public function get info():NetGroupInfo

相關 API 元素

localCoverageFrom

屬性 
localCoverageFrom:String  [唯讀]

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10.1, AIR 2

指定此節點「最接近」且負責的群組位址範圍開始位置。指定的範圍沿著群組位址環 mod 2256 增加方向。



實作
    public function get localCoverageFrom():String

相關 API 元素

localCoverageTo

屬性 
localCoverageTo:String  [唯讀]

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10.1, AIR 2

指定此節點「最接近」且負責的群組位址範圍結束位置。指定的範圍沿著群組位址環 mod 2256 增加方向。



實作
    public function get localCoverageTo():String

相關 API 元素

neighborCount

屬性 
neighborCount:Number  [唯讀]

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10.1, AIR 2

指定此節點直接連接的群組成員數目。



實作
    public function get neighborCount():Number

相關 API 元素

receiveMode

屬性 
receiveMode:String

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10.1, AIR 2

將此節點的路由接收模式指定為 NetGroupReceiveMode enum 類別中的其中一個值。



實作
    public function get receiveMode():String
    public function set receiveMode(value:String):void

相關 API 元素

replicationStrategy

屬性 
replicationStrategy:String

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10.1, AIR 2

指定物件複寫取得策略。該值是 NetGroupReplicationStrategy 類別的其中一個列舉值。



實作
    public function get replicationStrategy():String
    public function set replicationStrategy(value:String):void

相關 API 元素

建構函式詳細資料

NetGroup

()建構函式
public function NetGroup(connection:NetConnection, groupspec:String)

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10.1, AIR 2

在指定的 NetConnection 物件上建構 NetGroup,並且將其加入到 groupspec 指定的群組。

在大部份的情況下,groupspec 可以在本機系統上使用網路上行。當使用 groupspec 建構 NetStream 或 NetGroup 物件時,Flash Player 會顯示「私用」對話方塊。此對話方塊會詢問 Flash Player 是否可以使用該連線來與使用者的對等共用資料。如果使用者按一下「允許此網域」,下次使用者連線至此應用程式時,不會顯示該對話方塊。如果使用者不允許對等協助網路,則會停用在群組中的所有對等功能 (發表、直接路由、物件複寫以及多點傳送)。如果權限允許,會連同 info 物件之 code 屬性中的 NetGroup.Connect.Success 傳送 NetStatusEvent 到 NetConnection 的事件偵聽程式。如果拒絕權限,code 屬性是 NetGroup.Connect.Rejected。在接收到 NetGroup.Connect.Success 事件之前,如果您嘗試呼叫任何 NetGroup 物件的方法,便會擲出例外。

注意:當用戶端訂閱原生 IP 多點傳送串流時,不會顯示安全性對話方塊。

參數
connection:NetConnection — NetConnection 物件。
 
groupspec:String — 指定要加入之 RTMFP 對等式群組的字串,包含它的名稱、功能、限制及這個成員的授權。
     new NetGroup(myConnection, myGroupSpecifier.groupspecWithAuthorizations());
     

擲回值
ArgumentError — NetConnection 實體尚未連線。
 
Error — groupspec 是無效的。

相關 API 元素

方法詳細資訊

addHaveObjects

()方法
public function addHaveObjects(startIndex:Number, endIndex:Number):void

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10.1, AIR 2

startIndexendIndex 的物件新增到物件集,此節點會向滿足要求的鄰近節點 (做為物件) 通告此物件集。依預設值,Have 集是空的。索引必須是介於 0 到 9007199254740992 之間的整數。

如需物件複寫的詳細資訊,請參閱 Flash Media Server Developer's Guide 中的 "Replicate an object within a group"

這個方法會連同 info 物件 code 屬性中的 "NetGroup.Replication.Request" 傳送 NetStatusEvent 到 NetGroup 的事件偵聽程式。

注意:呼叫此方法之前,請先測試 NetGroup.Neighbor.Connect 事件。

參數

startIndex:Number — 增加到 Have 集的物件索引範圍開頭。
 
endIndex:Number — 增加到 Have 集的物件索引範圍結尾。


擲回值
RangeError — 傳送到這個方法的數字小於 0 或大於 9007199254740992。

相關 API 元素

addMemberHint

()方法 
public function addMemberHint(peerID:String):Boolean

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10.1, AIR 2

手動加入指定 peerID 為群組成員的記錄。只有拓撲需要時,才會馬上嘗試連線。

參數

peerID:String — 加到可能鄰近節點集的 peerID。

傳回值
Boolean — 成功為 TRUE ,失敗為 FALSE。

相關 API 元素

addNeighbor

()方法 
public function addNeighbor(peerID:String):Boolean

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10.1, AIR 2

立即直接連線到指定的 peerID,以手動加入鄰近節點,而且這個 peerID 必須已經在這個群組中。如果拓撲不需要的話,稍後可能會捨棄這個直接連線。

參數

peerID:String — 要馬上連線的 peerID。

傳回值
Boolean — 成功為 TRUE ,失敗為 FALSE。

相關 API 元素

addWantObjects

()方法 
public function addWantObjects(startIndex:Number, endIndex:Number):void

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10.1, AIR 2

startIndexendIndex 之間的物件新增到要擷取的物件集。索引必須是介於 0 到 9007199254740992 之間的整數。依預設值,Want 集是空的。

如需物件複寫的詳細資訊,請參閱 Flash Media Server Developer's Guide 中的 "Replicate an object within a group"

這個方法會連同 info.code 屬性中的 NetGroup.Replication.Fetch.SendNotify 傳送 NetStatusEvent 到 NetGroup 的事件偵聽程式。這個事件後面會接著 NetGroup.Replication.Fetch.FailedNetGroup.Replication.Fetch.Result 事件。

注意:呼叫此方法之前,請先測試 NetGroup.Neighbor.Connect 事件。

參數

startIndex:Number — 增加到 Want 集的物件索引範圍開頭。
 
endIndex:Number — 增加到 Want 集的物件索引範圍結尾。


擲回值
RangeError — 傳送到這個方法的數字小於 0 或大於 9007199254740992。

相關 API 元素

close

()方法 
public function close():void

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10.1, AIR 2

中斷群組的連線,並關閉這個 NetGroup。在呼叫這個方法後,這個 NetGroup 將無法使用。

convertPeerIDToGroupAddress

()方法 
public function convertPeerIDToGroupAddress(peerID:String):String

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10.1, AIR 2

將 peerID 轉換為適合搭配 sendToNearest() 方法使用的群組位址。

參數

peerID:String — 要轉換的 peerID。

傳回值
String — peerID 的群組位址。

相關 API 元素

denyRequestedObject

()方法 
public function denyRequestedObject(requestID:int):void

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10.1, AIR 2

對於之前利用 addHaveObjects() 宣告的物件,拒絕在 NetStatusEvent NetGroup.Replication.Request 接收的要求。要求者可能會再度要求這個物件,除非或直到這個要求從 Have 集撤銷。

如需物件複寫的詳細資訊,請參閱 Flash Media Server Developer's Guide 中的 "Replicate an object within a group"

注意:呼叫此方法之前,請先測試 NetGroup.Neighbor.Connect 事件。

參數

requestID:int — 在 NetGroup.Replication.Request 事件中指定的要求識別名稱。

相關 API 元素

post

()方法 
public function post(message:Object):String

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10.1, AIR 2

傳送訊息到群組的所有成員。若要呼叫此方法,GroupSpecifier.postingEnabled 屬性在傳遞給 NetGroup 建構函式的 groupspec 中必須為 true。如需詳細資訊,請參閱 Flash Media Server Developer's Guide 中的 "Post messages to a group"

所有的訊息必須是唯一的,與稍早發表訊息相同的訊息不會傳遞。使用序列號讓訊息變成唯一。

未排序訊息傳遞。不保證訊息傳遞。

使用 AMF 序列化訊息。此訊息可以是下列其中一種類型:Object、int、Number 或 String。訊息不能是 MovieClip。

這個方法會連同 info.code 屬性中的 "NetGroup.Posting.Notify" 傳送 NetStatusEvent 到 NetGroup 的事件偵聽程式。"NetGroup.Posting.Notify" 事件會同時傳送到用戶端與伺服器上的 NetGroup。

注意:呼叫此方法之前,請先測試 NetGroup.Neighbor.Connect 事件。

參數

message:Object — 傳送到群組所有其他成員的訊息。

傳回值
String — 如果發表的話,傳回訊息的 messageID,如果發生錯誤時傳回 null。messageID 是訊息序列化原始位元組 SHA256 的十六進位。

相關 API 元素


範例  ( 如何使用本範例 )

這是一個使用對等網路的簡易文字聊天應用程式。應用程式透過 RTMFP 連線至 Flash Media Server。伺服器會保留用戶端應用程式的指紋以及在用戶端連線後管理對等群組。不過,在用戶端 (對等) 之間傳送的所有資料 -- 資料不會傳回伺服器。

當您執行這個應用程式時,您可以在文字輸入欄位輸入任何群組名稱。GroupSpecifier 類別使用這個名稱 (以及您設定的任何 GroupSpecifier 屬性) 來建立一個字串,且永遠是群組的特有名稱。若要將其他用戶端連線至這個群組,用戶端必須使用相同的群組名稱。例如,如果用戶端 A 使用 "firstmesh"群組名稱,另一個用戶端想與用戶端 A 通訊時就必須也使用 "firstmesh" 這個群組名稱。 如果用戶端 B 使用 "kite" 群組名稱,它一定會連線成功,不過它會建立一個新的群組名稱而且無法與用戶端 A 或 "firstmesh" 群組中的任何人通訊。

若要執行此範例,請將一個 Button、Label、TextInput 以及 TextArea 組件新增至 Flash Pro 的 Library 中。



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

()方法 
public function removeHaveObjects(startIndex:Number, endIndex:Number):void

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10.1, AIR 2

startIndexendIndex 的物件從物件集移除,此節點會向滿足要求的鄰近節點 (做為物件) 通告此物件集。索引必須是介於 0 到 9007199254740992 之間的整數。

如需物件複寫的詳細資訊,請參閱 Flash Media Server Developer's Guide 中的 "Replicate an object within a group"

注意:呼叫此方法之前,請先測試 NetGroup.Neighbor.Connect 事件。

參數

startIndex:Number — 在 Have 集中移除物件索引範圍開頭。
 
endIndex:Number — 在 Have 集中移除物件索引範圍結尾。


擲回值
RangeError — 傳送到這個方法的數字小於 0 或大於 9007199254740992。

相關 API 元素

removeWantObjects

()方法 
public function removeWantObjects(startIndex:Number, endIndex:Number):void

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10.1, AIR 2

startIndexendIndex 之間的物件從要擷取的物件集中移除。索引必須是介於 0 到 9007199254740992 之間的整數。

如需物件複寫的詳細資訊,請參閱 Flash Media Server Developer's Guide 中的 "Replicate an object within a group"

注意:呼叫此方法之前,請先測試 NetGroup.Neighbor.Connect 事件。

參數

startIndex:Number — 在 Want 集中移除物件索引範圍開頭。
 
endIndex:Number — 在 Want 集中移除物件索引範圍結尾。


擲回值
RangeError — 傳送到這個方法的數字小於 0 或大於 9007199254740992。

相關 API 元素

sendToAllNeighbors

()方法 
public function sendToAllNeighbors(message:Object):String

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10.1, AIR 2

傳送訊息到所有的鄰近節點。如果至少選取了一個鄰近節點的話,傳回 NetGroupSendResult.SENT

如需傳遞訊息的詳細資訊,請參閱 Flash Media Server Developer's Guide 中的 "Route messages directly to a peer"

當節點接收到訊息時,NetStatusEvent 會連同 info 物件 code 屬性中的 NetGroup.SendTo.Notify 傳送到 NetGroup 的事件偵聽程式。

注意:呼叫此方法之前,請先測試 NetGroup.Neighbor.Connect 事件。

參數

message:Object — 要傳送的訊息。

傳回值
String — 指出傳送成功或失敗之 NetGroupSendResult 列舉類別的屬性。

相關 API 元素

sendToNearest

()方法 
public function sendToNearest(message:Object, groupAddress:String):String

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10.1, AIR 2

傳送訊息到距離指定群組位址最近的鄰近節點 (或本機節點)。從整個環形考量鄰近節點。如果訊息成功地傳送至其目的地,傳回 NetGroupSendResult.SENT

如需傳遞訊息的詳細資訊,請參閱 Flash Media Server Developer's Guide 中的 "Route messages directly to a peer"

當節點接收到訊息時,NetStatusEvent 會連同 info 物件 code 屬性中的 NetGroup.SendTo.Notify 傳送到 NetGroup 的事件偵聽程式。

注意:呼叫此方法之前,請先測試 NetGroup.Neighbor.Connect 事件。

參數

message:Object — 要傳送的訊息。
 
groupAddress:String — 要路由訊息的群組位址。

傳回值
String — 指出傳送成功或失敗之 NetGroupSendResult 列舉類別的屬性。

相關 API 元素

sendToNeighbor

()方法 
public function sendToNeighbor(message:Object, sendMode:String):String

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10.1, AIR 2

傳送訊息到 sendMode 參數指定的鄰近節點。如果訊息成功地傳送到要求的目的地,傳回 NetGroupSendResult.SENT

如需傳遞訊息的詳細資訊,請參閱 Flash Media Server Developer's Guide 中的 "Route messages directly to a peer"

當節點接收到訊息時,NetStatusEvent 會連同 info 物件 code 屬性中的 NetGroup.SendTo.Notify 傳送到 NetGroup 的事件偵聽程式。

注意:呼叫此方法之前,請先測試 NetGroup.Neighbor.Connect 事件。

參數

message:Object — 要傳送的訊息。
 
sendMode:String — 指定傳送訊息到鄰近節點之 NetGroupSendMode 列舉類別的屬性。

傳回值
String — 指出傳送成功或失敗之 NetGroupSendResult 列舉類別的屬性。

相關 API 元素

writeRequestedObject

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

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10.1, AIR 2

對於之前利用 addHaveObjects() 方法宣告的物件,滿足 NetStatusEvent NetGroup.Replication.Request 接收的要求。object 可以是下列其中一種:Object、int、Number 與 String。object 無法是 MovieClip。

如需物件複寫的詳細資訊,請參閱 Flash Media Server Developer's Guide 中的 "Replicate an object within a group"

注意:呼叫此方法之前,請先測試 NetGroup.Neighbor.Connect 事件。

參數

requestID:int — 在 NetGroup.Replication.Request 事件中指定的要求識別名稱。
 
object:Object — 對應於在 NetGroup.Replication.Request 事件中指定索引的物件。

相關 API 元素

事件詳細資訊

netStatus

事件
事件物件類型: flash.events.NetStatusEvent
屬性 NetStatusEvent.type = flash.events.NetStatusEvent.NET_STATUS

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0, Flash Player 10.1

在 NetGroup 物件回報其狀態或錯誤情況時傳送。netStatus 事件包含 info 屬性。info 屬性是含有事件資訊的物件,例如,連線嘗試成功或失敗。

定義 type 屬性值 (netStatus 事件物件)。

這個事件具有下列屬性:

屬性
bubblesfalse
cancelablefalse;沒有要取消的預設行為指令。
currentTarget正主動使用事件偵聽程式處理 Event 物件的物件。
info物件,其中包含描述該物件狀態或錯誤情況的屬性。
target回報其狀態的 NetConnection 或 NetStream 物件。

相關 API 元素

NetGroupExample.as

這是一個使用對等網路的簡易視訊聊天應用程式。應用程式透過 RTMFP 連線至 Flash Media Server。伺服器會保留用戶端應用程式的指紋以及在用戶端連線後管理對等群組。不過,在用戶端 (對等) 之間傳送的所有資料 -- 資料不會傳回伺服器。

當您執行這個應用程式時,您可以在文字輸入欄位輸入任何群組名稱。GroupSpecifier 類別使用這個名稱 (以及您設定的任何 GroupSpecifier 屬性) 來建立一個字串,且永遠是群組的特有名稱。若要將其他用戶端連線至這個群組,用戶端必須使用相同的群組名稱。例如,如果用戶端 A 使用 "firstmesh"群組名稱,另一個用戶端想與用戶端 A 通訊時就必須也使用 "firstmesh" 這個群組名稱。 如果用戶端 B 使用 "kite" 群組名稱,它一定會連線成功,不過它會建立一個新的群組名稱而且無法與用戶端 A 或 "firstmesh" 群組中的任何人通訊。


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="100%" height="100%" applicationComplete="OnApplicationComplete()">
    <mx:Script>
        <![CDATA[
            private var netConnection:NetConnection = null;
            private var netStream:NetStream = null;
            private var netGroup:NetGroup = null;
            private var video:Video = null;
            private var sequenceNumber:uint = 0;
            private var resizeTimer:Timer = null;

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

            [Bindable] private var connected:Boolean = false;
            [Bindable] private var joinedGroup:Boolean = false;

            private function OnApplicationComplete():void
            {
                userName.text = "user " + int(Math.random() * 65536);

                groupName.text = "channel" + (int(Math.random() * 899) + 101);

                resizeTimer = new Timer(2000.0);
                resizeTimer.addEventListener(TimerEvent.TIMER, DoResizeVideo);
                resizeTimer.start();
            }

            private function StatusMessage(msg:Object):void
            {
                statusLog.text += msg;
                statusLog.verticalScrollPosition = statusLog.textHeight;
                statusLog.validateNow();
            }

            private function NetStatusHandler(e:NetStatusEvent):void
            {
                StatusMessage(e.info.code);
                switch(e.info.code)
                {
                case "NetConnection.Connect.Success":
                    OnConnect();
                    break;

                case "NetConnection.Connect.Closed":
                case "NetConnection.Connect.Failed":
                case "NetConnection.Connect.Rejected":
                case "NetConnection.Connect.AppShutdown":
                case "NetConnection.Connect.InvalidApp":
                    OnDisconnect();
                    break;

                case "NetStream.Connect.Success": // e.info.stream
                    OnNetStreamConnect();
                    break;

                case "NetStream.Connect.Rejected": // e.info.stream
                case "NetStream.Connect.Failed": // e.info.stream
                    DoDisconnect();
                    break;

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

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

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


                case "NetStream.MulticastStream.Reset":
                case "NetStream.Buffer.Full":
                    DoResizeVideo();
                    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;
                }
            }

            private function DoConnect():void
            {
                StatusMessage("Connecting to \"" + SERVER + "\" ...\n");
                netConnection = new NetConnection();
                netConnection.addEventListener(NetStatusEvent.NET_STATUS, NetStatusHandler);
                netConnection.connect(SERVER);
            }

            private function OnConnect():void
            {
                var groupSpecifier:GroupSpecifier;

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

                groupSpecifier = new GroupSpecifier("max2009lab/" + groupName.text);
                groupSpecifier.multicastEnabled = true;
                groupSpecifier.postingEnabled = true;
                groupSpecifier.serverChannelEnabled = true;

                netStream = new NetStream(netConnection, groupSpecifier.groupspecWithAuthorizations());
                netStream.addEventListener(NetStatusEvent.NET_STATUS, NetStatusHandler);

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

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

            private function OnNetStreamConnect():void
            {
                netStream.client = this;

                var mic:Microphone = Microphone.getMicrophone();
                if(mic)
                {
                    mic.codec = SoundCodec.SPEEX;
                    mic.setSilenceLevel(0);

                    netStream.attachAudio(mic);

                    StatusMessage("got microphone\n");
                }

                var camera:Camera = Camera.getCamera();
                if(camera)
                {
                    camera.setMode(320, 240, 10);
                    camera.setQuality(30000, 0);
                    camera.setKeyFrameInterval(15);

                    videoDisplay.attachCamera(camera);
                    videoDisplay.maintainAspectRatio = true;

                    netStream.attachCamera(camera);

                    StatusMessage("got camera\n");
                }

                netStream.publish("stream");
            }

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

            private function DoDisconnect():void
            {
                if(netConnection)
                    netConnection.close();
                videoDisplay.attachCamera(null);
            }

            private function OnDisconnect():void
            {
                StatusMessage("Disconnected\n");
                netConnection = null;
                netStream = null;
                netGroup = null;
                connected = false;
                joinedGroup = false;
            }

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

            private function DoPost():void
            {
                var message:Object = new Object;

                message.user = userName.text;
                message.text = chatText.text;
                message.sequence = sequenceNumber++;
                message.sender = netConnection.nearID;

                netGroup.post(message);

                StatusMessage("==> " + chatText.text + "\n");

                chatText.callLater(ClearChatText);
            }

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

            private function DoResizeVideo(ignored:* = null):void
            {
                if(video)
                {
                    if( (0 == video.videoHeight)
                     || (0 == video.videoWidth)
                    )
                    {
                        video.height = videoDisplay.height;
                        video.width = videoDisplay.width;
                        video.x = 0;
                        video.y = 0;
                    }
                    else
                    {
                        var videoAspect:Number = Number(video.videoWidth) / Number(video.videoHeight);
                        var displayAspect:Number = Number(videoDisplay.width) / Number(videoDisplay.height);
                        var adjustFactor:Number;

                        if(videoAspect >= displayAspect) // video is wider than display
                        {
                            adjustFactor = Number(video.videoWidth) / Number(videoDisplay.width);
                            video.width = videoDisplay.width;
                            video.height = int(Number(video.videoHeight) / adjustFactor);
                            video.x = 0;
                            video.y = int((videoDisplay.height - video.height) / 2);
                        }
                        else
                        {
                            adjustFactor = Number(video.videoHeight) / Number(videoDisplay.height);
                            video.height = videoDisplay.height;
                            video.width = int(Number(video.videoWidth) / adjustFactor);
                            video.x = int((videoDisplay.width - video.width) / 2);
                            video.y = 0;
                        }
                    }
                }
            }

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

            public function ValidateConnectAllowed(isConnected:Boolean, groupNameText:String):Boolean
            {
                return (!isConnected) && (groupNameText.length > 0);
            }
        ]]>
    </mx:Script>

    <mx:VBox top="10" right="10" left="10" bottom="10" verticalGap="6">
        <mx:HBox width="100%">
            <mx:Text text="Group:"/>
            <mx:TextInput id="groupName" width="100%" text="default" enabled="{!connected}"/>
            <mx:Button label="Connect" click="DoConnect()" enabled="{ValidateConnectAllowed(connected, groupName.text)}" />
            <mx:Button label="Disconnect" click="DoDisconnect()" enabled="{connected}" />
        </mx:HBox>
        <mx:VideoDisplay id="videoDisplay" width="320" height="240" resize="DoResizeVideo()"/>
        <mx:TextArea id="statusLog" width="100%" height="100%"/>
        <mx:HBox width="100%">
            <mx:TextInput id="userName" width="160" />
            <mx:TextInput id="chatText" width="100%" enabled="{joinedGroup}" enter="DoPost()"/>
        </mx:HBox>
    </mx:VBox>

</mx:Application>




[ X ]為什麼顯示英文?
「ActionScript 3.0 參考」的內容是以英文顯示

並非所有「ActionScript 3.0 參考」的內容都翻譯為所有語言。當語言元素未翻譯時,就會以英文顯示。例如,ga.controls.HelpBox 類別並沒有翻譯為任何語言。因此在參考的繁體中文版本中,ga.controls.HelpBox 類別就會以英文顯示。