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

NetConnection  - 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 NetConnection
繼承NetConnection Inheritance EventDispatcher Inheritance Object

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

NetConnection 類別會在用戶端與伺服器之間建立雙向連線。用戶端可以是 Flash Player 或 AIR 應用程式。伺服器可以是網站伺服器、Flash Media Server、執行 Flash Remoting 的應用程式伺服器,或是 Adobe Stratus 服務。呼叫 NetConnection.connect() 以建立連線。使用 NetStream 類別透過連線來傳送媒體與資料的串流。

如需有關將內容與資料載入 Flash Player 與 AIR 的安全資訊,請參閱下列主題:

若要編寫此類別的回呼方法,您可以擴充此類別並在子類別中定義回呼方法,也可以將 client 屬性指定給物件,並定義該物件的回呼方法。

檢視範例

相關 API 元素



公用屬性
 屬性定義自
  client : Object
指出要針對其叫用回呼方法的物件。
NetConnection
  connected : Boolean
[唯讀] 指出應用程式是 (true) 否 (false) 透過持續的 RTMP 連線連到伺服器。
NetConnection
  connectedProxyType : String
[唯讀] 用於和 Flash Media Server 成功建立連線的 Proxy 類型。
NetConnection
 Inheritedconstructor : Object
類別物件的參照或是特定物件實體的建構函數。
Object
  defaultObjectEncoding : uint
[靜態] NetConnection 物件的預設物件編碼。
NetConnection
  farID : String
[唯讀] 這個 Flash Player 或 Adobe AIR 實體所連線之目標 Flash Media Server 實體的識別名稱。
NetConnection
  farNonce : String
[唯讀] 實際上由 Flash Media Server 選擇的值,這個連線的唯一值。
NetConnection
      httpIdleTimeout : Number
等待 HTTP 回應的時間 (毫秒)。
NetConnection
  maxPeerConnections : uint
Flash Player 或 Adobe AIR 的這個實體允許的傳入和傳出對等連線總數。
NetConnection
  nearID : String
[唯讀] 這個 NetConnection 實體使用的 Flash Player 或 Adobe AIR 實體的識別名稱。
NetConnection
  nearNonce : String
[唯讀] 實際上由這個 Flash Player 或 Adobe AIR 實體選擇的值,這個連線的唯一值。
NetConnection
  objectEncoding : uint
這個 NetConnection 實體的物件編碼。
NetConnection
  protocol : String
[唯讀] 用來建立連線的通訊協定。
NetConnection
  proxyType : String
決定初始 Flash Media Server 連線嘗試失敗時,要嘗試哪些後援方法。
NetConnection
  unconnectedPeerStreams : Array
[唯讀] 物件,其中保存所有與發佈中 NetStream 物件沒有關聯的對等訂閱者 NetStream 物件。
NetConnection
  uri : String
[唯讀] 傳遞到 NetConnection.connect() 方法的 URI。
NetConnection
  usingTLS : Boolean
[唯讀] 指出是否使用原本的 Transport Layer Security (TLS) 而非 HTTPS 建立安全的連線。
NetConnection
公用方法
 方法定義自
  
建立 NetConnection 物件。
NetConnection
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
會在 EventDispatcher 物件註冊事件偵聽程式,以便讓偵聽程式收到事件的通知。
EventDispatcher
  
addHeader(operation:String, mustUnderstand:Boolean = false, param:Object = null):void
將內容標頭加入 Action Message Format (AMF) 封包結構。
NetConnection
  
call(command:String, responder:Responder, ... arguments):void
在 Flash Media Server 上或在執行 Flash Remoting 的應用程式伺服器上呼叫命令或方法。
NetConnection
  
關閉於本機開啟或連到伺服器的連線,並傳送 code 屬性為 NetConnection.Connect.Closed 的 netStatus 事件。
NetConnection
  
connect(command:String, ... arguments):void
建立連至 Flash Media Server 上應用程式或連至 Flash Remoting 的雙向連線,或是為 RTMFP 對等式群組通訊建立雙向網路端點。
NetConnection
 Inherited
會將事件傳送到事件流程。
EventDispatcher
 Inherited
會檢查 EventDispatcher 物件是否有對特定的事件類型註冊偵聽程式。
EventDispatcher
 Inherited
指出物件是否有已定義的指定屬性。
Object
 Inherited
指出 Object 類別的實體是否位於指定為參數的物件原型鏈中。
Object
 Inherited
指出指定的屬性是否存在,以及是否可列舉。
Object
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
會從 EventDispatcher 物件移除偵聽程式。
EventDispatcher
 Inherited
為迴圈作業設定動態屬性的可用性。
Object
 Inherited
傳回代表此物件的字串,根據地區特定慣例進行格式化。
Object
 Inherited
會傳回指定之物件的字串形式。
Object
 Inherited
會傳回指定之物件的基本值。
Object
 Inherited
檢查此 EventDispatcher 物件是否已註冊事件偵聽程式,或者此物件的任何祖系已為特定事件類型註冊事件偵聽程式。
EventDispatcher
事件
 事件 摘要 定義自
 Inherited[廣播事件] 當 Flash Player 或 AIR 應用程式取得作業系統焦點並成為作用中時傳送。EventDispatcher
  會在以非同步方式 (亦即,從原生非同步程式碼) 擲出例外時傳送。NetConnection
 Inherited[廣播事件] 當 Flash Player 或 AIR 應用程式失去作業系統焦點並成為非作用中時傳送。EventDispatcher
  會在發生輸入或輸出錯誤,因而導致網路作業失敗時傳送。NetConnection
  在 NetConnection 物件回報其狀態或錯誤情況時傳送。NetConnection
  當 NetConnection.call() 的呼叫嘗試連線至呼叫者安全執行程序以外的伺服器時傳送。NetConnection
屬性詳細資訊

client

屬性
client:Object

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

指出要針對其叫用回呼方法的物件。 預設值為此 NetConnection 實體。 如果您將 client 屬性設定為其它物件,就會在該物件上叫用回呼方法。



實作
    public function get client():Object
    public function set client(value:Object):void

擲回值
TypeError client 屬性必須設定為非 null 物件。

connected

屬性 
connected:Boolean  [唯讀]

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

指出應用程式是 (true) 否 (false) 透過持續的 RTMP 連線連到伺服器。透過 HTTP 進行連線時,這個屬性是 false,唯一的例外是連線到應用程式伺服器上的 Flash Remoting 服務時為 true



實作
    public function get connected():Boolean

connectedProxyType

屬性 
connectedProxyType:String  [唯讀]

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

用於和 Flash Media Server 成功建立連線的 Proxy 類型。可能值為:"none""HTTP""HTTPS""CONNECT"

如果連線未穿透或是原生 SSL 連線,則值為 "none"

如果連線是透過 HTTP 來穿透,則值為 "HTTP"

如果連線是透過 HTTPS 來穿透,則值為 "HTTPS"

如果連線使用透過 Proxy 伺服器的 CONNECT 方法來穿透,則值為 "CONNECT"



實作
    public function get connectedProxyType():String

擲回值
ArgumentError — 當 NetConnection 實體尚未連線時,嘗試存取此屬性。

defaultObjectEncoding

屬性 
defaultObjectEncoding:uint

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

NetConnection 物件的預設物件編碼。將二進位資料寫入或讀取到物件時,defaultObjectEncoding 屬性會指示用來將資料序列化的 Action Message Format (AMF) 版本:ActionScript 3.0 格式 (ObjectEncoding.AMF3) 或 ActionScript 1.0 和 ActionScript 2.0 格式 (ObjectEncoding.AMF0)。

預設值是 ObjectEncoding.AMF3。 變更 NetConnection.defaultObjectEncoding 並不會影響現有的 NetConnection 實體,只會影響後續建立的實體。

若要個別設定物件的編碼 (而非設定整個應用程式的物件編碼),請改為設定 NetConnection 物件的 objectEncoding 屬性。

如需詳細資訊,請參閱 objectEncoding 屬性的說明。



實作
    public static function get defaultObjectEncoding():uint
    public static function set defaultObjectEncoding(value:uint):void

相關 API 元素

farID

屬性 
farID:String  [唯讀]

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5

這個 Flash Player 或 Adobe AIR 實體所連線之目標 Flash Media Server 實體的識別名稱。這個屬性對 RTMFP 連線才有意義。只有在建立 RTMFP 連線之後,才會有這個屬性的值。



實作
    public function get farID():String

相關 API 元素

farNonce

屬性 
farNonce:String  [唯讀]

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5

實際上由 Flash Media Server 選擇的值,這個連線的唯一值。這個值會對伺服器顯示為其 client.nearNonce 值。這個值僅針對 RTMFP、RTMPE 與 RTMPTE 連線定義。



實作
    public function get farNonce():String
    

httpIdleTimeout

屬性 
httpIdleTimeout:Number

語言版本: ActionScript 3.0
執行階段版本: AIR 2.6

等待 HTTP 回應的時間 (毫秒)。預設值為零。

  • httpIdleTimeout 值為 Number
  • 使用 HTTP連線時,正值表示非作用中連線應該維持開啟的毫秒數。
  • 值為零時表示應該使用平台的預設網路閒置逾時值。
  • 負值將造成 RangeError
  • 如果超過 httpIdleTimeout 值,就會傳送 netStatus 事件。
  • 此屬性只會影響以 HTTP 連線建立的 NetConnection 物件。以 RTMP、RTMFP 或其他 HTTP 通道建立的 NetConnection 物件不受此屬性的影響。
    //Set the timeout to 5 seconds
    connection = new NetConnection();
    connection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
    connection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
    connection.httpIdleTimeout = 5000;
    
在 Linux 系統中,相較於使用 httpIdleTimeout 指定的值,NetConnection 可能會經過更多秒數才會逾時。



實作
    public function get httpIdleTimeout():Number
    public function set httpIdleTimeout(value:Number):void

maxPeerConnections

屬性 
maxPeerConnections:uint

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5

Flash Player 或 Adobe AIR 的這個實體允許的傳入和傳出對等連線總數。預設值為 8。

這個值不會區別發行者和訂閱者連線。如果這個值在對等連線期間降低,新值只會影響新的傳入連線,不會捨棄現有連線。



實作
    public function get maxPeerConnections():uint
    public function set maxPeerConnections(value:uint):void

nearID

屬性 
nearID:String  [唯讀]

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5

這個 NetConnection 實體使用的 Flash Player 或 Adobe AIR 實體的識別名稱。這個屬性對 RTMFP 連線才有意義。

每個 NetConnection 實體都具有唯一的 nearID 屬性。Flash Player 或 Adobe AIR 實體或 NetConnection 實體不會有相同的識別名稱。

其它 Flash Player 或 Adobe AIR 實體會將這個識別名稱做為與這個用戶端進行 NetStream 新連線中的 peerID。隨後,這個識別名稱就是任何連線至這個實體的對等 NetStream 中的 farID



實作
    public function get nearID():String

相關 API 元素

nearNonce

屬性 
nearNonce:String  [唯讀]

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5

實際上由這個 Flash Player 或 Adobe AIR 實體選擇的值,這個連線的唯一值。這個值會對伺服器顯示為其 client.farNonce 值。這個值僅針對 RTMFP、RTMPE 與 RTMPTE 連線定義。



實作
    public function get nearNonce():String

objectEncoding

屬性 
objectEncoding:uint

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

這個 NetConnection 實體的物件編碼。

將二進位資料寫入或讀取到物件時,defaultObjectEncoding 屬性會指示用來將資料序列化的 Action Message Format (AMF) 版本:ActionScript 3.0 格式 (ObjectEncoding.AMF3) 或 ActionScript 1.0 和 ActionScript 2.0 格式 (ObjectEncoding.AMF0)。設定 objectEncoding 屬性,以設定 NetConnection 實體的 AMF 版本。

如果您的應用程式需要與 Flash Player 9 之前版本的伺服器通訊,請務必瞭解這個屬性。可能的情況有下列三種:

  • 連線到支援 AMF3 的伺服器 (例如 Flex Data Services 2 或 Flash Media Server 3)。 defaultObjectEncoding 的預設值是 ObjectEncoding.AMF3。 在這個檔案中建立的所有 NetConnection 實體都會使用 AMF3 序列化,因此您不需要設定 objectEncoding 屬性。
  • 連線到不支援 AMF3 的伺服器 (例如 Flash Media Server 2)。 在這種情況下,請將靜態的 NetConnection.defaultObjectEncoding 屬性設定為 ObjectEncoding.AMF0。 在此 SWF 檔中建立的所有 NetConnection 實體都會使用 AMF0 序列化, 所以您不需要設定 objectEncoding 屬性。
  • 連線至使用不同編碼版本的多部伺服器。 請使用每個連線的 objectEncoding 屬性 (而非使用 defaultObjectEncoding),針對每個連線設定物件編碼。 將它設定為 ObjectEncoding.AMF0 可連線到使用 AMF0 編碼的伺服器 (例如 Flash Media Server 2),而將它設定為 ObjectEncoding.AMF3 可連線到使用 AMF3 編碼的伺服器 (例如 Flex Data Services 2)。

在 NetConnection 實體連線之後,其 objectEncoding 屬性會是唯讀的。

如果您使用錯誤的編碼來連線至伺服器,NetConnection 物件就會傳送 netStatus 事件。NetStatusEvent.info 屬性含有 code 屬性值為 NetConnection.Connect.Failed 的資訊物件,以及說明物件編碼不正確的說明。



實作
    public function get objectEncoding():uint
    public function set objectEncoding(value:uint):void

擲回值
ReferenceError — 當 NetConnection 實體已連線時,嘗試設定 objectEncoding 屬性值。
 
ArgumentError — 此屬性已設定為 ObjectEncoding.AMF0ObjectEncoding.AMF3 以外的值。

相關 API 元素

protocol

屬性 
protocol:String  [唯讀]

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5

用來建立連線的通訊協定。使用 Flash Media Server 時,這個屬性具有意義。可能值如下:

  • "rtmp":即時訊息通訊協定 (RTMP)
  • "rtmpe":加密的 RTMP
  • "rtmpt":HTTP 穿透技術 RTMP
  • "rtmpte":HTTP 穿透技術加密的 RTMP
  • "rtmps":HTTPS 式 RTMP
  • "rtmfp":即時媒體流量通訊協定 (RTMFP)



實作
    public function get protocol():String

擲回值
ArgumentError — 當 NetConnection 實體尚未連線時,嘗試存取此屬性。

proxyType

屬性 
proxyType:String

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

決定初始 Flash Media Server 連線嘗試失敗時,要嘗試哪些後援方法。 請先設定 proxyType 屬性,之後才能呼叫 NetConnection.connect() 方法。

可接受的值為 "none""HTTP""CONNECTOnly""CONNECT""best"。預設值為 "none"

若要使用原生 SSL,請將屬性設定為 "best"。如果播放程式無法直接連線至伺服器 (透過預設連接埠 443 或是透過您指定的其他連接埠),而且 Proxy 伺服器已就位,播放程式會嘗試使用 CONNECT 方法。如果該嘗試失敗,播放程式會透過 HTTPS 來穿透。

如果屬性設定為 "CONNECTOnly",播放程式就會嘗試先使用 CONNECT 方法。如果該方法失敗,就沒有後援。

如果屬性設定為 "HTTP" 而且直接連線失敗,就會使用 HTTP 穿透技術。如果此屬性設定為 "CONNECT" 而且直接連線失敗,就會使用穿透技術的 CONNECT 方法。如果該方法失敗,連線將不會使用後援的 HTTP 穿透技術。

只有在使用 RTMP、RTMPS 或 RTMPT 時,才適用這個屬性。CONNECTCONNECTOnly 方法只適用於透過 Proxy 伺服器連線至網路的使用者。



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

unconnectedPeerStreams

屬性 
unconnectedPeerStreams:Array  [唯讀]

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5

物件,其中保存所有與發佈中 NetStream 物件沒有關聯的對等訂閱者 NetStream 物件。與發佈 NetStream 物件相關聯的訂閱者 NetStream 物件是位於 NetStream.peerStreams 陣列。



實作
    public function get unconnectedPeerStreams():Array

相關 API 元素

uri

屬性 
uri:String  [唯讀]

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

傳遞到 NetConnection.connect() 方法的 URI。如果尚未呼叫 NetConnection.connect() 或未傳遞 URI,則這個屬性是 undefined



實作
    public function get uri():String

usingTLS

屬性 
usingTLS:Boolean  [唯讀]

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

指出是否使用原本的 Transport Layer Security (TLS) 而非 HTTPS 建立安全的連線。 這個屬性只有在 NetConnection 物件已連線時才有效。



實作
    public function get usingTLS():Boolean

擲回值
ArgumentError — 當 NetConnection 實體尚未連線時,嘗試存取此屬性。
建構函式詳細資料

NetConnection

()建構函式
public function NetConnection()

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

建立 NetConnection 物件。 呼叫 connect() 方法以建立連線。

如果應用程式必須與 Flash Player 9 之前發行的伺服器進行通訊,您可能必須設定 NetConnection 物件的 objectEncoding 屬性。

下列程式碼會建立 NetConnection 物件。

     var nc:NetConnection = new NetConnection();
     

相關 API 元素

方法詳細資訊

addHeader

()方法
public function addHeader(operation:String, mustUnderstand:Boolean = false, param:Object = null):void

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

將內容標頭加入 Action Message Format (AMF) 封包結構。 此標頭未來會隨每個 AMF 封包一併傳送。 如果您使用相同名稱呼叫 NetConnection.addHeader(),新的標頭就會取代現有的標頭,而且新的標頭會在 NetConnection 物件持續期間保存。 您可以使用標頭名稱呼叫 NetConnection.addHeader(),藉由這種移除未定義之物件的方式移除此標頭。

參數

operation:String — 識別標頭以及與它相關聯的 ActionScript 物件資料。
 
mustUnderstand:Boolean (default = false) — 值為 true 表示伺服器必須先了解並處理此標頭,然後再處理下列任何標頭或訊息。
 
param:Object (default = null) — ActionScript 物件。

call

()方法 
public function call(command:String, responder:Responder, ... arguments):void

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

在 Flash Media Server 上或在執行 Flash Remoting 的應用程式伺服器上呼叫命令或方法。呼叫 NetConnection.call() 之前,您必須呼叫 NetConnection.connect() 以連線到伺服器。 您必須建立伺服器端函數,以傳遞給此方法。

您不可以連接到常用的保留連接埠。完整的封鎖連接埠清單,請參閱在「ActionScript 3.0 開發人員指南」中的「限制網路 API」

參數

command:String — 使用 [objectPath/]method 格式指定的方法。 例如,someObject/doSomething 命令會告知遠端伺服器呼叫 clientObject.someObject.doSomething() 方法,並使用所有的選擇性 ... arguments 參數。如果物件路徑遺失,就會在遠端伺服器上叫用 clientObject.doSomething()

使用 Flash Media Server 時,命令是指於應用程式的伺服器端指令碼中定義的函數名稱。 如果伺服器端指令碼放在應用程式目錄的根目錄中,您就不必在命令前使用物件路徑。

 
responder:Responder — 選擇性物件,用來處理伺服器的傳回值。 Responder 物件可具有兩個已定義的方法,以便處理傳回的結果:resultstatus。 如果傳回錯誤做為結果,就會叫用 status;否則會叫用 result。 Responder 物件可以處理與特定作業相關的錯誤,而 NetConnection 物件則會回應與連線狀態相關的錯誤。
 
... arguments — 可為任何 ActionScript 類型的選擇性引數,包括其它 ActionScript 物件的參照。 在遠端應用程式伺服器上執行此方法時,這些引數就會傳遞給 command 參數中指定的方法。


事件
securityError:SecurityErrorEvent — 某個呼叫嘗試與呼叫者安全執行程序以外的伺服器通訊。 您可以使用伺服器上的原則檔來避免這個問題。

相關 API 元素

close

()方法 
public function close():void

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

關閉於本機開啟或連到伺服器的連線,並傳送 code 屬性為 NetConnection.Connect.ClosednetStatus 事件。

這個方法會使連線上執行的所有 NetStream 物件離線。 尚未傳送的佇列資料將全部捨棄 (若只要結束本機或伺服器串流,但不要關閉連線,請使用 NetStream.close())。 如果關閉連線,之後想要建立新連線,您必須建立新的 NetConnection 物件,並重新呼叫 connect() 方法。

close() 方法也會使在這個連線上執行的所有遠端共享物件離線。 但是,您不需要重新建立共享物件以重新連線, 您只需要改用呼叫 SharedObject.connect() 的方式重新建立共享物件的連線即可。 同時,當您重新建立與共享物件的連線後,就會送出之前在您發出 NetConnection.close() 時已在共享物件中排入佇列的所有資料。

使用 Flash Media Server 時,最好的程式開發作法是在用戶端不再需要與伺服器連線時呼叫 close()。 呼叫 close() 是清除未儲存連線的最快方法。 您可以將伺服器設定為會自動關閉閒置連線,以做為備用的方法。 如需詳細資訊,請參閱「Flash Media Server 設定及管理指南」。

相關 API 元素

connect

()方法 
public function connect(command:String, ... arguments):void

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

建立連至 Flash Media Server 上應用程式或連至 Flash Remoting 的雙向連線,或是為 RTMFP 對等式群組通訊建立雙向網路端點。為了報告其狀態或錯誤情況,對 NetConnection.connect() 的呼叫會傳送 netStatus 事件。

呼叫 NetConnection.connect() 以執行下列作業:

  • 傳遞 "null",以便從本機檔案系統或網站伺服器中播放視訊和 MP3 檔案。
  • 傳遞 "http" URL,以連線至執行 Flash Remoting 的應用程式伺服器。使用 NetServices 類別可透過 NetConnection 物件對應用程式伺服器呼叫函數,並傳回結果。 如需詳細資訊,請參閱「Flash Remoting 文件」。
  • 傳遞 "rtmp/e/s" URL,以連線至 Flash Media Server 應用程式。
  • 傳遞 "rtmfp" URL,以便為 RTMFP 用戶端伺服器、對等式及 IP 多點傳送通訊,建立雙向網路端點。
  • 傳遞 "rtmfp:" 字串,以便為 RTMFP IP 多點傳送通訊,建立無伺服器的雙向網路端點。

請考慮下列安全性模式:

  • 根據預設,Flash Player 或 AIR 會拒絕安全執行程序之間的存取。但是網站可以使用 URL 原則檔案,啟用對資源的存取。
  • 您的應用程式可以拒絕對伺服器上資源的存取。 在 Flash Media Server 應用程式中,請使用伺服器端 ActionScript 程式碼來拒絕存取。請參閱 Flash Media Server 文件
  • 如果呼叫的檔案是在具有檔案系統的本機安全執行程序中,就無法呼叫 NetConnection.connect()
  • 您不可以連接到常用的保留連接埠。完整的封鎖連接埠清單,請參閱在「ActionScript 3.0 開發人員指南」中的「限制網路 API」
  • 若要防止 SWF 檔案呼叫這個方法,請在包含 SWF 內容的 HTML 網頁中,設定 objectembed 標籤的 allowNetworking 參數。

但在 Adobe AIR 中,application 安全執行程序中的內容 (使用 AIR 應用程式所安裝的內容) 沒有這些安全性限制。

如需有關安全性的詳細資訊,請參閱「Adobe Flash Playe 開發人員中心」:安全性

參數

command:String — 使用以下其中一個 command 參數值:
  • 若要從本機檔案系統或是網站伺服器中播放視訊與 MP3 檔案,請傳遞 null
  • 若要連線至執行 Flash Remoting 的應用程式伺服器,請傳遞使用 http 通訊協定的 URL。
  • (Flash Player 10.1 或 AIR 2 或更新的版本) 若要為 RTMFP IP 多點傳送通訊建立無伺服器的網路端點,請傳遞 "rtmfp:" 字串。請使用此連線類型,以便不使用伺服器,即接收發行者的 IP 多點傳送串流。您也可以使用此連線類型,以便透過 IP 多點傳送來探索相同區域網路 (LAN) 上的對等。
  • 此連線類型具有下列限制:

    只有在相同區域網路上的對等才可以探索彼此。

    透過 IP 多點傳送,Flash Player 即可接收串流,但無法傳送串流。

    Flash Player 與 AIR 可以在對等式群組中傳送和接收串流,但是必須在相同區域網路上使用 IP 多點傳送來探索對等。

    這個技術不能用於一對一通訊。

  • 若要連線至 Flash Media Server,請傳遞伺服器上應用程式的 URI。請使用下列語法 (方括弧中的項目是選擇性的):

    protocol:[//host][:port]/appname[/instanceName]

    使用下列其中一個通訊協定:rtmprtmpertmpsrtmptrtmptertmfp。如果連線成功,會傳回 code 屬性為 NetConnection.Connect.SuccessnetStatus 事件。 如需有關回應 connect() 呼叫所傳回的所有事件代碼清單,請參閱 NetStatusEvent.info 屬性。

    如果是在同一部主機上提供檔案與安裝伺服器,則可以省略 //host 參數。如果省略 /instanceName 參數,Flash Player 或 AIR 會連線到應用程式的預設實體。

    (Flash Player 10.1 或 AIR 2 或更新的版本) 若要建立對等應用程式,請使用 rtmfp 通訊協定。

 
... arguments — 傳遞給應用程式 (會在 command 中指定) 的任何選擇性參數類型。使用 Flash Media Server 時,會傳遞額外的引數給應用程式伺服器端程式碼中的 application.onConnect() 事件處理常式。 您必須在 onConnect() 中定義和處理引數。


擲回值
ArgumentError — 傳遞給 command 參數的 URI 格式不正確。
 
IOError — 連線失敗。 如果您從 netStatus 事件處理常式內呼叫 connect(),就可能會發生這項錯誤,因為這是不允許的。
 
SecurityError — 具有檔案系統的本機 SWF 檔無法與網際網路進行通訊。您可以透過將此 SWF 檔重新分類為具有網路連線的本機或受信任,避免此問題。
 
SecurityError — 您不可以連接到常用的保留連接埠。完整的封鎖連接埠清單,請參閱在「ActionScript 3.0 開發人員指南」中的「限制網路 API」

相關 API 元素

事件詳細資訊

asyncError

事件
事件物件類型: flash.events.AsyncErrorEvent
屬性 AsyncErrorEvent.type = flash.events.AsyncErrorEvent.ASYNC_ERROR

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

會在以非同步方式 (亦即,從原生非同步程式碼) 擲回例外時傳送。

AsyncErrorEvent.ASYNC_ERROR 常數會定義 asyncError 事件物件的 type 屬性值。

這個事件具有下列屬性:

屬性
bubblesfalse
cancelablefalse;沒有要取消的預設行為指令。
currentTarget正主動使用事件偵聽程式處理 Event 物件的物件。
target傳送該事件的物件。
error觸發事件的錯誤。

ioError

事件  
事件物件類型: flash.events.IOErrorEvent
屬性 IOErrorEvent.type = flash.events.IOErrorEvent.IO_ERROR

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

會在發生輸入或輸出錯誤,因而導致網路作業失敗時傳送。

定義 ioError 事件物件的 type 屬性值。

這個事件具有下列屬性:

屬性
bubblesfalse
cancelablefalse;沒有要取消的預設行為指令。
currentTarget正主動使用事件偵聽程式處理 Event 物件的物件。
errorID與特定錯誤相關聯的參考號碼 (僅限 AIR)。
target遭遇輸入/輸出錯誤的網路物件。
text要顯示為錯誤訊息的文字。

netStatus

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

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

在 NetConnection 物件回報其狀態或錯誤情況時傳送。 netStatus 事件含有 info 屬性,而此屬性是含有事件相關特定資訊 (例如,嘗試連線成功或失敗) 的資訊物件。

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

這個事件具有下列屬性:

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

相關 API 元素

securityError

事件  
事件物件類型: flash.events.SecurityErrorEvent
屬性 SecurityErrorEvent.type = flash.events.SecurityErrorEvent.SECURITY_ERROR

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

當 NetConnection.call() 的呼叫嘗試連線至呼叫者安全執行程序以外的伺服器時傳送。

SecurityErrorEvent.SECURITY_ERROR 常數會定義 securityError 事件物件的 type 屬性值。

這個事件具有下列屬性:

屬性
bubblesfalse
cancelablefalse;沒有要取消的預設行為指令。
currentTarget正主動使用事件偵聽程式處理 Event 物件的物件。
target回報安全性錯誤的網路物件。
text要顯示為錯誤訊息的文字。

相關 API 元素

NetConnectionExample.as

下列範例會使用 Video 物件與 NetConnection 和 NetStream 類別,以載入並播放 FLV 檔案。

在這個範例中,是將建立 Video 和 NetStream 物件的程式碼與呼叫 Video.attachNetStream()NetStream.play() 方法置入處理常式函數中。 只有在嘗試連線至 NetConnection 物件成功後才會呼叫處理常式;也就是 netStatus 事件傳回的 info 物件中含有表示成功的 code 屬性。 建議您先等候連線成功,然後再呼叫 NetStream.play()

package {
    import flash.display.Sprite;
    import flash.events.NetStatusEvent;
    import flash.events.SecurityErrorEvent;
    import flash.media.Video;
    import flash.net.NetConnection;
    import flash.net.NetStream;
    import flash.events.Event;

    public class NetConnectionExample extends Sprite {
        private var videoURL:String = "http://www.helpexamples.com/flash/video/cuepoints.flv";
        private var connection:NetConnection;
        private var stream:NetStream;
        private var video:Video = new Video();        

        public function NetConnectionExample() {
            connection = new NetConnection();
            connection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
            connection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
            connection.connect(null);
        }

        private function netStatusHandler(event:NetStatusEvent):void {
            switch (event.info.code) {
                case "NetConnection.Connect.Success":
                    connectStream();
                    break;
                case "NetStream.Play.StreamNotFound":
                    trace("Stream not found: " + videoURL);
                    break;
            }
        }

        private function securityErrorHandler(event:SecurityErrorEvent):void {
            trace("securityErrorHandler: " + event);
        }

        private function connectStream():void {
            addChild(video);
            var stream:NetStream = new NetStream(connection);
            stream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
            stream.client = new CustomClient();
            video.attachNetStream(stream);
            stream.play(videoURL);
        }
    }
}

class CustomClient {
    public function onMetaData(info:Object):void {
        trace("metadata: duration=" + info.duration + " width=" + info.width + " height=" + info.height + " framerate=" + info.framerate);
    }
    public function onCuePoint(info:Object):void {
        trace("cuepoint: time=" + info.time + " name=" + info.name + " type=" + info.type);
    }
}




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

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