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

UncaughtErrorEvent  - 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.events

介面
IEventDispatcher
 
類別
AccelerometerEvent
ActivityEvent
AsyncErrorEvent
AudioOutputChangeEvent
AVDictionaryDataEvent
AVHTTPStatusEvent
AVPauseAtPeriodEndEvent
BrowserInvokeEvent    
ContextMenuEvent
DataEvent
DatagramSocketDataEvent    
DeviceRotationEvent    
DNSResolverEvent    
DRMAuthenticateEvent    
DRMAuthenticationCompleteEvent
DRMAuthenticationErrorEvent
DRMDeviceGroupErrorEvent
DRMDeviceGroupEvent
DRMErrorEvent
DRMLicenseRequestEvent
DRMMetadataEvent
DRMReturnVoucherCompleteEvent
DRMReturnVoucherErrorEvent
DRMStatusEvent
ErrorEvent
Event
EventDispatcher
EventPhase
FileListEvent    
FocusEvent
FullScreenEvent
GameInputEvent    
GeolocationEvent
GestureEvent
GesturePhase
HTMLUncaughtScriptExceptionEvent    
HTTPStatusEvent
IMEEvent
InvokeEvent    
IOErrorEvent
KeyboardEvent
LocationChangeEvent    
MediaEvent    
MouseEvent
NativeDragEvent    
NativeProcessExitEvent    
NativeWindowBoundsEvent    
NativeWindowDisplayStateEvent    
NetDataEvent
NetMonitorEvent
NetStatusEvent
OutputProgressEvent    
PermissionEvent
PressAndTapGestureEvent
ProgressEvent
RemoteNotificationEvent    
SampleDataEvent
ScreenMouseEvent    
SecurityErrorEvent
ServerSocketConnectEvent    
ShaderEvent
SoftKeyboardEvent
SoftKeyboardTrigger
SQLErrorEvent    
SQLEvent    
SQLUpdateEvent    
StageOrientationEvent    
StageVideoAvailabilityEvent
StageVideoEvent
StatusEvent
StorageVolumeChangeEvent    
SyncEvent
TextEvent
ThrottleEvent
ThrottleType
TimerEvent
TouchEvent
TouchEventIntent    
TransformGestureEvent
UncaughtErrorEvent
UncaughtErrorEvents
VideoEvent
VideoTextureEvent
VsyncStateChangeAvailabilityEvent    
套件flash.events
類別public class UncaughtErrorEvent
繼承UncaughtErrorEvent Inheritance ErrorEvent Inheritance TextEvent Inheritance Event Inheritance Object

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

當發生未捕捉到的錯誤時,UncaughtErrorEvents 類別的實體會傳送一個 UncaughtErrorEvent 物件。在任何 try..catch 區塊外面發生錯誤時,或傳送的 ErrorEvent 物件沒有註冊偵聽程式時,就會發生未捕捉到的錯誤。未捕捉到的錯誤事件功能通常被描述成「全域錯誤處理常式」。

傳送此事件的 UncaughtErrorEvents 物件與 LoaderInfo 物件或 Loader 物件有關。請使用以下屬性來存取 UncaughtErrorEvents 實體:

  • LoaderInfo.uncaughtErrorEvents:在同一個 SWF 定義的程式碼中偵測未捕捉的錯誤。
  • Loader.uncaughtErrorEvents:在 Loader 物件載入的 SWF 中,偵測程式碼中定義的未捕捉錯誤。

uncaughtError 事件發生時,即使事件已獲得處理,也無法在造成錯誤的呼叫堆疊中繼續執行。如果錯誤屬於一種同步錯誤,則不會執行發生錯誤之函數的其餘程式碼。因此,發生未捕捉到的錯誤事件時,您的應用程式可能會處於不隱定的狀態。因為造成未捕捉到錯誤的原因很多,所以無法預測仍然可以使用的功能。例如,您的應用程式可能仍然可執行網路作業或檔案作業。不過,這些作業也可能無法使用。

當一個 SWF 載入另一個 SWF 時,uncaughtError 事件會在 LoaderInfo 階層中重新上下反昇。例如,假設 A.swf 使用 Loader 實體來載入 B.swf。如果在 B.swf 發生未捕捉到的錯誤,就會按照以下順序,傳送 uncaughtError 事件至 LoaderInfo 以及 Loader 物件:

  1. (捕捉階段) A.swf 的 LoaderInfo
  2. (捕捉階段) A.swf 的 Loader
  3. (目標階段) B.swf 的 LoaderInfo
  4. (反昇階段) A.swf 的 Loader
  5. (反昇階段) A.swf 的 LoaderInfo

Loader 物件的 uncaughtErrorEvents 屬性絕不會在目標階段中傳送 uncaughtErrorEvent。它只會在捕捉階段和反昇階段中傳送事件。

與其他事件反昇一樣,呼叫 stopPropagation()stopImmediatePropagation() 會讓事件停止傳送至任何其他偵聽程式,但兩者有一個重大的差異。Loader 物件的 UncaughtErrorEvents 物件會被視為與載入之 SWF 的 LoaderInfo.uncaughtErrorEvents 物件成對,這麼做的目的是為了傳輸事件。如果在其中一個物件上註冊的偵聽程式呼叫 stopPropagation() 方法,則在事件傳輸結束之前,仍會將事件傳送至在該 UncaughtErrorEvents 物件註冊的其他偵聽程式,以及傳送至在成對之 UncaughtErrorEvents 物件註冊的偵聽程式。 stopImmediatePropagation() 方法仍然會禁止將事件傳送至所有其他的偵聽程式。

當內容在執行階段的除錯程式版本上執行 (例如,除錯程式版本的 Flash Player 或 AIR Debug Launcher (ADL)) 時,發生未捕捉到的錯誤時就會顯示未捕捉到的錯誤對話方塊。對於這些執行階段版本,即使已對 uncaughtError 事件註冊除錯程式,還是會顯示錯誤對話方塊。若要避免在這種情況下顯示對話方塊,請呼叫 UncaughtErrorEvent 物件的 preventDefault() 方法。

如果 Loader 物件載入的內容是 AVM1 (ActionScript 2) SWF 檔案,AVM1 SWF 檔案中未捕捉到的錯誤,不會導致 uncaughtError 事件。此外,載入 HTMLLoader 物件 (包含 Flex HTML 控制) 之 HTML 內容中的 JavaScript 錯誤,不會導致 uncaughtError 事件。

檢視範例

相關 API 元素



公用屬性
 屬性定義自
 Inheritedbubbles : Boolean
[唯讀] 指出事件是否為反昇事件。
Event
 Inheritedcancelable : Boolean
[唯讀] 指出是否可避免與事件相關聯的行為指令。
Event
 Inheritedconstructor : Object
類別物件的參照或是特定物件實體的建構函數。
Object
 InheritedcurrentTarget : Object
[唯讀] 正主動使用事件偵聽程式處理 Event 物件的物件。
Event
  error : *
[唯讀] 與未捕捉到的錯誤有關的錯誤物件。
UncaughtErrorEvent
 InheritederrorID : int
[唯讀] 包含與特定錯誤相關聯的參考號碼。
ErrorEvent
 InheritedeventPhase : uint
[唯讀] 事件流程中的目前階段。
Event
 Inheritedtarget : Object
[唯讀] 事件目標。
Event
 Inheritedtext : String
用於 textInput 事件,代表使用者所輸入的字元或字元序列。
TextEvent
 Inheritedtype : String
[唯讀] 事件類型。
Event
公用方法
 方法定義自
  
UncaughtErrorEvent(type:String, bubbles:Boolean = true, cancelable:Boolean = true, error_in:* = null)
建立包含 uncaughtError 事件相關資訊的 UncaughtErrorEvent 物件。
UncaughtErrorEvent
  
[覆寫] 建立 UncaughtErrorEvent 物件的副本,然後設定每個屬性值以符合原始物件的屬性值。
UncaughtErrorEvent
 Inherited
formatToString(className:String, ... arguments):String
公用程式函數,可用來實作自訂 ActionScript 3.0 Event 類別中的 toString() 方法。
Event
 Inherited
指出物件是否有已定義的指定屬性。
Object
 Inherited
檢查是否已經對事件呼叫 preventDefault() 方法。
Event
 Inherited
指出 Object 類別的實體是否位於指定為參數的物件原型鏈中。
Object
 Inherited
如果可以取消事件的預設行為指令,則取消該行為指令。
Event
 Inherited
指出指定的屬性是否存在,以及是否可列舉。
Object
 Inherited
為迴圈作業設定動態屬性的可用性。
Object
 Inherited
避免處理事件流程中,目前節點以及任何後續節點中的任何事件偵聽程式。
Event
 Inherited
避免處理接續在事件流程中的目前節點之後,後續節點中的任何事件偵聽程式。
Event
 Inherited
傳回代表此物件的字串,根據地區特定慣例進行格式化。
Object
  
[覆寫] 傳回包含 UncaughtErrorEvent 物件所有屬性的字串。
UncaughtErrorEvent
 Inherited
會傳回指定之物件的基本值。
Object
公用常數
 常數定義自
  UNCAUGHT_ERROR : String = "uncaughtError"
[靜態] 定義 uncaughtError 事件物件的 type 屬性值。
UncaughtErrorEvent
屬性詳細資訊

error

屬性
error:*  [唯讀]

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

與未捕捉到的錯誤有關的錯誤物件。一般情況下,此物件的資料類型會屬於以下其中一種:

  • Error 實體 (或其子類別的實體)。如果未捕捉到的錯誤是由 throw 陳述式建立的同步錯誤,例如使用 try..catch 區塊捕捉到的錯誤。
  • ErrorEvent 實體 (或其子類別的實體)。 如果未捕捉到的錯誤是一種發生錯誤時,會傳送錯誤的非同步錯誤。

不過,error 屬性可以是任何資料類型的物件。ActionScript 不限制 throw 陳述式只能用於 Error 物件。例如,以下程式碼同時適用於編譯階段以及執行階段:

throw new Sprite()

如果 throw 陳述式未被 try..catch 區塊捕捉,則 throw 陳述式會觸發一個 uncaughtError 事件。在這種情況下,被傳送之 UncaughtErrorEvent 的 error 屬性為 throw 陳述式建構的 Sprite 物件。

因此,在您的 uncaughtError 偵聽程式中,您應該檢查 error 屬性的資料類型。下列範例將示範此檢查:

         function uncaughtErrorHandler(event:UncaughtErrorEvent):void
         {
             var message:String;
             
             if (event.error is Error)
             {
                 message = Error(event.error).message;
             }
             else if (event.error is ErrorEvent)
             {
                 message = ErrorEvent(event.error).text;
             }
             else
             {
                 message = event.error.toString();
             }
         }

如果 error 屬性包含一個 Error 實體 (或 Error 子類別),則可用的錯誤資訊會因內容執行處的執行階段版本而有所不同,如下所示:

  • 在除錯程式版本的執行階段中,例如除錯程式版本的 Flash Player 或 AIR Debug Launcher (ADL):

    • Error.getStackTrace() 方法會傳回造成錯誤的呼叫堆疊
    • Error.message 包含完整錯誤訊息文字
  • 在非除錯程式版本的執行階段中:

    • Error.getStackTrace() 方法會傳回造成錯誤的呼叫堆疊。不過,呼叫堆疊資訊不包括來源檔案名稱或行號。
    • Error.message 屬性包含錯誤訊息的簡要版本,它通常是 Error.errorIDError.name 屬性的組合
  • 在非除錯程式版本的執行階段中 (Flash Player 11.4 或更早版本與 AIR 1.4 或更早版本):

    • Error.getStackTrace() 方法傳回 null
    • Error.message 屬性包含錯誤訊息的簡要版本,它通常是 Error.errorIDError.name 屬性的組合

所有的執行階段版本都會提供其他所有的 Error 類別屬性和方法。

請注意,如果 error 屬性是 ErrorEvent 實體,就不會有呼叫堆疊資訊。



實作
    public function get error():*
建構函式詳細資料

UncaughtErrorEvent

()建構函式
public function UncaughtErrorEvent(type:String, bubbles:Boolean = true, cancelable:Boolean = true, error_in:* = null)

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

建立包含 uncaughtError 事件相關資訊的 UncaughtErrorEvent 物件。

參數
type:String (default = NaN) — 事件類型。
 
bubbles:Boolean (default = true) — 判斷 Event 物件是否參與事件流程的反昇階段。事件偵聽程式可以透過繼承的 bubbles 屬性來存取此資訊。
 
cancelable:Boolean (default = true) — 判斷是否可以取消 Event 物件。事件偵聽程式可以透過繼承的 cancelable 屬性來存取此資訊。
 
error_in:* (default = null) — 與尚未捕捉或尚未處理的錯誤有關的物件 (正常情況下的 Error 或 ErrorEvent 物件)。
方法詳細資訊

clone

()方法
override public function clone():Event

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

建立 UncaughtErrorEvent 物件的副本,然後設定每個屬性值以符合原始物件的屬性值。

傳回值
Event — 新的 UncaughtErrorEvent 物件,其屬性值符合原始物件的屬性值。

toString

()方法 
override public function toString():String

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

傳回包含 UncaughtErrorEvent 物件所有屬性的字串。

傳回值
String — 包含 UncaughtErrorEvent 物件所有屬性的字串。
常數詳細資訊

UNCAUGHT_ERROR

常數
public static const UNCAUGHT_ERROR:String = "uncaughtError"

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

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

注意:若在 try 區塊中,則會有呼叫其事件處理常式的事件發送程式,而且 catch 區塊不會捕捉以事件處理常式擲回的錯誤。透過偵聽 LoaderInfo.uncaughtErrorEvents 可以捕捉之後擲回的任何錯誤。

這個事件具有下列屬性:

屬性
bubblestrue
cancelabletrue;取消事件會讓未捕捉到的錯誤對話方塊不顯示於除錯程式執行階段版本中。
currentTarget正主動使用事件偵聽程式處理 Event 物件的物件。
error未捕捉到的錯誤。
target與發生錯誤的 SWF 有關的 LoaderInfo 物件。
text文字錯誤訊息。

UncaughtErrorEventExample.1.as

以下範例示範如何使用未捕捉到的錯誤事件處理常式,在 ActionScript 專案中偵測未捕捉到的錯誤。這個範例會定義 uncaughtError 事件處理常式來偵測未捕捉到的錯誤。它也會提供一個按鈕,只要按一下,就會擲回一個由未捕捉到的錯誤處理常式所捕捉到的錯誤。

在建構函式中,程式碼會為 LoaderInfo 物件的 uncaughtErrorEvents 屬性所傳送的 uncaughtError 事件註冊一個偵聽程式。

uncaughtErrorHandler() 方法中,程式碼會檢查 error 屬性的資料類型,並視情況提供適當的回應。

package
{
    import flash.display.Sprite;
    import flash.events.ErrorEvent;
    import flash.events.MouseEvent;
    import flash.events.UncaughtErrorEvent;

    public class UncaughtErrorEventExample extends Sprite
    {
        public function UncaughtErrorEventExample()
        {
            loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, uncaughtErrorHandler);
            
            drawUI();
        }
        
        private function uncaughtErrorHandler(event:UncaughtErrorEvent):void
        {
            if (event.error is Error)
            {
                var error:Error = event.error as Error;
                // do something with the error
            }
            else if (event.error is ErrorEvent)
            {
                var errorEvent:ErrorEvent = event.error as ErrorEvent;
                // do something with the error
            }
            else
            {
                // a non-Error, non-ErrorEvent type was thrown and uncaught
            }
        }
        
        private function drawUI():void
        {
            var btn:Sprite = new Sprite();
            btn.graphics.clear();
            btn.graphics.beginFill(0xFFCC00);
            btn.graphics.drawRect(0, 0, 100, 50);
            btn.graphics.endFill();
            addChild(btn);
            btn.addEventListener(MouseEvent.CLICK, clickHandler);
        }
        
        private function clickHandler(event:MouseEvent):void
        {
            throw new Error("Gak!");
        }
    }
}
UncaughtErrorEventExample.1.5.as

以下範例使用 Flex,得到與前一個範例相同的效果。它使用 MXML 文件取代 ActionScript 類別,做為根內容。
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
                       xmlns:s="library://ns.adobe.com/flex/spark" 
                       xmlns:mx="library://ns.adobe.com/flex/halo"
                       applicationComplete="applicationCompleteHandler();">
    
    <fx:Script>
        <![CDATA[
            import flash.events.ErrorEvent;
            import flash.events.MouseEvent;
            import flash.events.UncaughtErrorEvent;
            
            private function applicationCompleteHandler():void
            {
                loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, uncaughtErrorHandler);
            }
    
            private function uncaughtErrorHandler(event:UncaughtErrorEvent):void
            {
                if (event.error is Error)
                {
                    var error:Error = event.error as Error;
                    // do something with the error
                }
                else if (event.error is ErrorEvent)
                {
                    var errorEvent:ErrorEvent = event.error as ErrorEvent;
                    // do something with the error
                }
                else
                {
                    // a non-Error, non-ErrorEvent type was thrown and uncaught
                }
            }
            
            private function clickHandler(event:MouseEvent):void
            {
                throw new Error("Gak!");
            }
        ]]>
    </fx:Script>
      
    <s:Button label="Cause Error" click="clickHandler(event);"/>
</s:WindowedApplication>
UncaughtErrorEventExample.2.as

以下範例示範如何使用未捕捉到的錯誤事件處理常式,在載入的 SWF 中偵測未捕捉到的錯誤。這個範例會定義 uncaughtError 事件處理常式來偵測未捕捉到的錯誤。

在建構函式中,程式碼會建立一個 Loader 物件,然後為 Loader 物件的 uncaughtErrorEvents 屬性所傳送的 uncaughtError 事件註冊一個偵聽程式。

uncaughtErrorHandler() 方法中,程式碼會檢查 error 屬性的資料類型,並視情況提供適當的回應。

package
{
    import flash.display.Loader;
    import flash.display.Sprite;
    import flash.events.ErrorEvent;
    import flash.events.UncaughtErrorEvent;
    import flash.net.URLRequest;

    public class LoaderUncaughtErrorEventExample extends Sprite
    {
        private var ldr:Loader;
        
        public function LoaderUncaughtErrorEventExample()
        {
            ldr = new Loader();
            ldr.load(new URLRequest("child.swf"));
            ldr.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, uncaughtErrorHandler);
        }
        
        private function uncaughtErrorHandler(event:UncaughtErrorEvent):void
        {
            if (event.error is Error)
            {
                var error:Error = event.error as Error;
                // do something with the error
            }
            else if (event.error is ErrorEvent)
            {
                var errorEvent:ErrorEvent = event.error as ErrorEvent;
                // do something with the error
            }
            else
            {
                // a non-Error, non-ErrorEvent type was thrown and uncaught
            }
        }
    }
}




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

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