用于 Adobe® Flash® Platform 的 ActionScript® 3.0 参考
主页  |  隐藏包列表和类列表 |   |   |  新增内容  |  索引  |  附录  |  为什么显示为英语?
过滤条件: AIR 30.0 和更早版本, Flash Player 30.0 和更早版本, Flash Lite 4
Flex 4.6 和更早版本, Flash Pro CS6 和更早版本
隐藏过滤条件
flash.display 

LoaderInfo  - 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 的标签
Motion XML 元素
Timed Text 标记
不推荐使用的元素的列表
AccessibilityImplementation 常量
如何使用 ActionScript 示例
法律声明
flash.display
public class LoaderInfo
继承LoaderInfo Inheritance EventDispatcher Inheritance Object

语言版本: ActionScript 3.0
运行时版本: AIR 1.0, Flash Player 9, Flash Lite 4

LoaderInfo 类可提供有关已加载的 SWF 文件或图像文件(JPEG、GIF 或 PNG)的信息。LoaderInfo 对象可用于任何显示对象。提供的信息包括加载进度、加载程序的 URL 和加载内容、媒体的字节总数以及媒体的标示的高度和宽度。

您可以通过以下两种方法访问 LoaderInfo 对象:

  • flash.display.Loader 对象的 contentLoaderInfo 属性 -- contentLoaderInfo 属性始终可用于任何 Loader 对象。对于尚未调用 load()loadBytes() 方法,或者尚未充分加载的 Loader 对象,在尝试访问 contentLoaderInfo 属性的多个属性时,将引发错误。
  • 显示对象的 loaderInfo 属性。

Loader 对象的 contentLoaderInfo 属性提供有关 Loader 对象正在加载的内容的信息,而 DisplayObject 的 loaderInfo 属性提供有关该显示对象的根 SWF 文件的信息。

当使用 Loader 对象加载显示对象(如 SWF 文件或位图)时,显示对象的 loaderInfo 属性与 Loader 对象 (DisplayObject.loaderInfo = Loader.contentLoaderInfo) 的 contentLoaderInfo 属性相同。由于 SWF 文件的主类的实例没有 Loader 对象,因此 loaderInfo 属性是访问 SWF 文件主类实例的 LoaderInfo 的唯一方法。

下图显示了对于 SWF 文件主类实例、Loader 对象的 contentLoaderInfo 属性以及加载对象的 loaderInfo 属性,LoaderInfo 对象的不同用法:

显示 LoaderInfo 的不同应用情况的图像

在加载操作未完成时,Loader 对象的 contentLoaderInfo 属性的某些属性不可用。您可以获得某些属性,如 bytesLoadedbytesTotalurlloaderURLapplicationDomain。当 loaderInfo 对象调度 init 事件时,您可以访问 loaderInfo 对象以及加载的图像或 SWF 文件的所有属性。

注意:LoaderInfo 对象的所有属性都是只读的。

EventDispatcher.dispatchEvent() 方法不适用于 LoaderInfo 对象。如果在 LoaderInfo 对象上调用 dispatchEvent(),将引发 IllegalOperationError 异常。

查看示例

相关 API 元素



公共属性
 属性由以下参数定义
  actionScriptVersion : uint
[只读] 被加载的 SWF 文件的 ActionScript 版本。
LoaderInfo
  applicationDomain : ApplicationDomain
[只读] 加载外部 SWF 文件后,包含在已加载类中的所有 ActionScript 3.0 定义将存储在 applicationDomain 属性中。
LoaderInfo
  bytes : ByteArray
[只读] 与 LoaderInfo 对象相关联的字节数。
LoaderInfo
  bytesLoaded : uint
[只读] 媒体已加载的字节数。
LoaderInfo
  bytesTotal : uint
[只读] 整个媒体文件中压缩的字节数。
LoaderInfo
  childAllowsParent : Boolean
[只读] 表示内容(子级)对加载者(父级)的信任关系。
LoaderInfo
  childSandboxBridge : Object
一个对象,它可以通过所加载内容的代码进行设置以公开可以由 Loader 对象的沙箱中的代码访问的属性和方法。
LoaderInfo
 Inheritedconstructor : Object
对类对象或给定对象实例的构造函数的引用。
Object
  content : DisplayObject
[只读] 与此 LoaderInfo 对象关联的已加载对象。
LoaderInfo
  contentType : String
[只读] 被加载文件的 MIME 类型。
LoaderInfo
  frameRate : Number
[只读] 被加载的 SWF 文件的标示的帧速率,以每秒帧数为单位。
LoaderInfo
  height : int
[只读] 加载文件的标示的高度。
LoaderInfo
  isURLInaccessible : Boolean
[只读] 表示 LoaderInfo.url 属性是否已截断。
LoaderInfo
  loader : Loader
[只读] 与此 LoaderInfo 对象关联的 Loader 对象。
LoaderInfo
  loaderURL : String
[只读] SWF 文件的 URL,该 SWF 文件启动对此 LoaderInfo 对象所描述的媒体的加载。
LoaderInfo
  parameters : Object
[只读] 包含名称-值对的对象,表示为被加载的 SWF 文件提供的参数。
LoaderInfo
  parentAllowsChild : Boolean
[只读] 表示加载者(父级)对内容(子级)的信任关系。
LoaderInfo
  parentSandboxBridge : Object
一个对象,它可以在 Loader 对象的沙箱中通过代码进行设置以公开可以由所加载内容的代码访问的属性和方法。
LoaderInfo
  sameDomain : Boolean
[只读] 表示加载者和内容之间的域关系:如果它们具有相同的原始域,则为 true;否则为 false。
LoaderInfo
  sharedEvents : EventDispatcher
[只读] EventDispatcher 实例,可用于跨安全边界交换事件。
LoaderInfo
  swfVersion : uint
[只读] 已加载的 SWF 文件的文件格式版本。
LoaderInfo
  uncaughtErrorEvents : UncaughtErrorEvents
[只读] 一个在此 LoaderInfo 对象的 SWF 文件中的代码中发生无法处理的错误时调度 uncaughtError 事件的对象。
LoaderInfo
  url : String
[只读] 所加载媒体的 URL。
LoaderInfo
  width : int
[只读] 被加载内容的标示的宽度。
LoaderInfo
公共方法
 方法由以下参数定义
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
使用 EventDispatcher 对象注册事件侦听器对象,以使侦听器能够接收事件通知。
EventDispatcher
  
[静态] 返回与定义为对象的 SWF 文件相关联的 LoaderInfo 对象。
LoaderInfo
 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
  成功加载数据后调度。LoaderInfo
 Inherited[广播事件] Flash Player 或 AIR 应用程序失去操作系统焦点并变为非活动状态时将调度此事件。EventDispatcher
  在通过 HTTP 发出网络请求并且可以检测到 HTTP 状态代码时调度。LoaderInfo
  当已加载的 SWF 文件的属性和方法可供访问并做好使用准备时进行调度。LoaderInfo
  在发生导致加载操作失败的输入或输出错误时调度。LoaderInfo
  在加载操作开始时调度。LoaderInfo
  在下载操作过程中收到数据时调度。LoaderInfo
  每次使用 Loader 对象的 unload() 方法删除已加载对象时,或者当同一 Loader 对象执行第二次加载并且在加载开始之前删除了原始内容时,由 LoaderInfo 对象调度。LoaderInfo
属性详细信息

actionScriptVersion

属性
actionScriptVersion:uint  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0, Flash Player 9, Flash Lite 4

被加载的 SWF 文件的 ActionScript 版本。通过使用 ActionScriptVersion 类中的枚举(如 ActionScriptVersion.ACTIONSCRIPT2ActionScriptVersion.ACTIONSCRIPT3)来指定语言版本。

注意:此属性始终具有值 ActionScriptVersion.ACTIONSCRIPT2ActionScriptVersion.ACTIONSCRIPT3。ActionScript 1.0 和 2.0 都被报告为 ActionScriptVersion.ACTIONSCRIPT2(版本 2.0)。此属性只对 ActionScript 1.0 和 2.0 与 ActionScript 3.0 进行区分。



实现
    public function get actionScriptVersion():uint

引发
Error — 如果文件未完整下载,不足以检索到所请求的信息。
 
Error — 如果文件不是 SWF 文件。

相关 API 元素

applicationDomain

属性 
applicationDomain:ApplicationDomain  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0, Flash Player 9, Flash Lite 4

加载外部 SWF 文件后,包含在已加载类中的所有 ActionScript 3.0 定义将存储在 applicationDomain 属性中。

SWF 文件中的所有代码被定义为存在于应用程序域中。主应用程序就在当前的应用程序域中运行。系统域包含所有应用程序域,包括当前域和由 Flash Player 或 Adobe AIR 使用的所有类。

所有应用程序域(系统域除外)都有关联的父域。主应用程序的 applicationDomain 的父域为系统域。已加载的类仅在其父级中没有相关定义时才进行定义。不能用较新的定义覆盖已加载的类定义。

有关应用程序域的使用示例,请参阅《ActionScript 3.0 开发人员指南》中的“客户端系统环境”一章。



实现
    public function get applicationDomain():ApplicationDomain

引发
SecurityError — 不允许调用方的此安全沙箱访问此 ApplicationDomain。

相关 API 元素

bytes

属性 
bytes:ByteArray  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0, Flash Player 9.0.115.0, Flash Lite 4

与 LoaderInfo 对象相关联的字节数。



实现
    public function get bytes():ByteArray

引发
SecurityError — 如果由于安全限制的缘故而阻止访问此 API 的对象访问加载的对象。例如,如果 Loader 对象尝试访问 contentLoaderInfo.content 属性,但未向其授予访问加载的内容的安全权限,则可能会出现此情况。

有关安全性的详细信息,请参阅 Flash Player 开发人员中心主题:安全性

bytesLoaded

属性 
bytesLoaded:uint  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0, Flash Player 9, Flash Lite 4

媒体已加载的字节数。如果此数字与 bytesTotal 的值相等,则会加载所有字节。



实现
    public function get bytesLoaded():uint

bytesTotal

属性 
bytesTotal:uint  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0, Flash Player 9, Flash Lite 4

整个媒体文件中压缩的字节数。

在此 LoaderInfo 对象相应的 Loader 对象调度第一个 progress 事件之前,bytesTotal 为 0。在该 Loader 对象调度第一个 progress 事件之后,bytesTotal 反映的是要下载的实际字节数。

注意(仅限 iOS):在 iOS 上运行应用程序时,返回值与其他平台上的返回值不同。



实现
    public function get bytesTotal():uint

相关 API 元素

childAllowsParent

属性 
childAllowsParent:Boolean  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0, Flash Player 9, Flash Lite 4

表示内容(子级)对加载者(父级)的信任关系。如果子项允许父项访问,则为 true;否则为 false。如果子对象已调用 allowDomain() 方法向父域授予权限,或者在子域中加载了向父域授予权限的 URL 策略,则将此属性设置为 true。如果子级和父级在同一域中,则此属性设置为 true

有关安全性的详细信息,请参阅 Flash Player 开发人员中心主题:安全性



实现
    public function get childAllowsParent():Boolean

引发
Error — 文件未完整下载而不足以检索到所请求的信息时引发。

childSandboxBridge

属性 
childSandboxBridge:Object

运行时版本: AIR 1.0, Flash Player 11.4, Flash Lite 4

一个对象,它可以通过所加载内容的代码进行设置以公开可以由 Loader 对象的沙箱中的代码访问的属性和方法。此沙箱桥使来自非应用程序域的内容对应用程序沙箱中的脚本具有受控访问权限,反之亦然。沙箱桥充当沙箱之间的通道,在应用程序安全沙箱和非应用程序安全沙箱之间提供显式交互。



实现
    public function get childSandboxBridge():Object
    public function set childSandboxBridge(value:Object):void

引发
SecurityError — 只有所加载内容的沙箱中的内容可以设置此属性。

相关 API 元素

content

属性 
content:DisplayObject  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0, Flash Player 9, Flash Lite 4

与此 LoaderInfo 对象关联的已加载对象。



实现
    public function get content():DisplayObject

引发
SecurityError — 如果由于安全限制的缘故而阻止访问此 API 的对象访问加载的对象。例如,如果 Loader 对象尝试访问 contentLoaderInfo.content 属性,但未向其授予访问加载的内容的安全权限,则可能会出现此情况。

有关安全性的详细信息,请参阅 Flash Player 开发人员中心主题:安全性

contentType

属性 
contentType:String  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0, Flash Player 9, Flash Lite 4

被加载文件的 MIME 类型。如果所加载的文件内容不足以确定类型,则该值为 null。以下列表给出了可能的值:

  • "application/x-shockwave-flash"
  • "image/jpeg"
  • "image/gif"
  • "image/png"



实现
    public function get contentType():String

frameRate

属性 
frameRate:Number  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0, Flash Player 9, Flash Lite 4

被加载的 SWF 文件的标示的帧速率,以每秒帧数为单位。此数字通常是整数,但并不需要是整数。

此值可能与使用时的实际帧速率不同。Flash Player 或 Adobe AIR 在任何时候为所有加载的 SWF 文件只使用单个帧速率,此帧速率由主 SWF 文件的标称帧速率确定。此外,根据硬件、声音同步和其他因素,可能无法达到主帧速率。



实现
    public function get frameRate():Number

引发
Error — 如果文件未完整下载,不足以检索到所请求的信息。
 
Error — 如果文件不是 SWF 文件。

height

属性 
height:int  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0, Flash Player 9, Flash Lite 4

加载文件的标示的高度。此值可能与所显示内容的实际高度不同,因为被加载的内容或其父显示对象可能被缩放。



实现
    public function get height():int

引发
Error — 如果文件未完整下载,不足以检索到所请求的信息。

isURLInaccessible

属性 
isURLInaccessible:Boolean  [只读]

语言版本: ActionScript 3.0
运行时版本: Flash Player 10.1, AIR 2

表示 LoaderInfo.url 属性是否已截断。当 isURLInaccessible 值为 true 时,LoaderInfo.url 值只是从中加载内容的最终 URL 的域。例如,如果从 http://www.adobe.com/assets/hello.swf 加载内容,并且 LoaderInfo.url 属性的值为 http://www.adobe.com,则此属性会被截断。仅当下列所有值也全部为 true 时,isURLInaccessible 值才为 true

  • 当加载此内容时,发生 HTTP 重定向。
  • 调用 Loader.load() 的 SWF 文件所在域与此内容的最终 URL 所在域不同。
  • 调用 Loader.load() 的 SWF 文件不具有访问此内容的权限。授予访问此内容的权限的方式与为 BitmapData.draw() 授予权限的方式相同:调用 Security.allowDomain() 以访问 SWF 文件(或对于非 SWF 文件内容,建立一个策略文件并使用 LoaderContext.checkPolicyFile 属性)。

注意:isURLInaccessible 属性是为 Flash Player 10.1 和 AIR 2.0 添加的。但是,如果 Flash 运行时支持该属性,则该属性适用于所有版本的 SWF 文件。因此,在“严谨模式”下使用某些创作工具会导致出现编译错误。要避免出现此错误,请使用间接语法 myLoaderInfo["isURLInaccessible"],或禁用严谨模式。如果您使用的是 Flash Professional CS5 或 Flex SDK 4.1,则可以对在 Flash Player 10.1 和 AIR 2 之前发布的运行时使用和编译此 API。

对于 AIR 中的应用程序内容,该属性的值始终为 false



实现
    public function get isURLInaccessible():Boolean

相关 API 元素

loader

属性 
loader:Loader  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0, Flash Player 9, Flash Lite 4

与此 LoaderInfo 对象关联的 Loader 对象。如果此 LoaderInfo 对象是 SWF 文件的主类实例的 loaderInfo 属性,则没有关联的 Loader 对象。



实现
    public function get loader():Loader

引发
SecurityError — 如果由于安全限制的缘故而阻止访问此 API 的对象访问 Loader 对象。例如,如果加载的 SWF 文件尝试访问其 loaderInfo.loader 属性,但未向其授予访问正在加载的 SWF 文件的安全权限,则可能会出现此情况。

有关安全性的详细信息,请参阅 Flash Player 开发人员中心主题:安全性

loaderURL

属性 
loaderURL:String  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0, Flash Player 9, Flash Lite 4

SWF 文件的 URL,该 SWF 文件启动对此 LoaderInfo 对象所描述的媒体的加载。对于 SWF 文件的主类的实例,此 URL 与 SWF 文件自己的 URL 相同。



实现
    public function get loaderURL():String

parameters

属性 
parameters:Object  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0, Flash Player 9, Flash Lite 4

包含名称-值对的对象,表示为被加载的 SWF 文件提供的参数。

可以使用 for-in 循环来提取 parameters 对象中的所有名称和值。

参数的两个源为:主 SWF 文件的 URL 中的查询字符串和 FlashVars HTML 参数(这只影响主 SWF 文件)的值。

parameters 属性替换了 ActionScript 1.0 和 2.0 提供 SWF 文件参数作为主时间轴的技术。

Loader 对象(该对象包含使用 ActionScript 1.0 或 2.0 的 SWF 文件)的 parameters 属性的值为 null。只有对于包含使用 ActionScript 3.0 的 SWF 文件的 Loader 对象,该值才非 null。



实现
    public function get parameters():Object

parentAllowsChild

属性 
parentAllowsChild:Boolean  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0, Flash Player 9, Flash Lite 4

表示加载者(父级)对内容(子级)的信任关系。如果父项允许子项访问,则为 true;否则为 false。如果父对象调用了 allowDomain() 方法向子域授予权限,或者在父域中加载了向子域授予权限的 URL 策略文件,则将此属性设置为 true。如果子级和父级在同一域中,则此属性设置为 true

有关安全性的详细信息,请参阅 Flash Player 开发人员中心主题:安全性



实现
    public function get parentAllowsChild():Boolean

引发
Error — 文件未完整下载而不足以检索到所请求的信息时引发。

parentSandboxBridge

属性 
parentSandboxBridge:Object

运行时版本: AIR 1.0, Flash Player 11.4, Flash Lite 4

一个对象,它可以在 Loader 对象的沙箱中通过代码进行设置以公开可以由所加载内容的代码访问的属性和方法。此沙箱桥使来自非应用程序域的内容对应用程序沙箱中的脚本具有受控访问权限,反之亦然。沙箱桥充当沙箱之间的通道,在应用程序安全沙箱和非应用程序安全沙箱之间提供显式交互。



实现
    public function get parentSandboxBridge():Object
    public function set parentSandboxBridge(value:Object):void

引发
SecurityError — 只有 Loader 对象的沙箱中的内容可以设置此属性。

相关 API 元素

sameDomain

属性 
sameDomain:Boolean  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0, Flash Player 9, Flash Lite 4

表示加载者和内容之间的域关系:如果它们具有相同的原始域,则为 true;否则为 false



实现
    public function get sameDomain():Boolean

引发
Error — 文件未完整下载而不足以检索到所请求的信息时引发。

sharedEvents

属性 
sharedEvents:EventDispatcher  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0, Flash Player 9, Flash Lite 4

EventDispatcher 实例,可用于跨安全边界交换事件。即使 Loader 对象和加载的内容源于彼此不信任的安全域,两者仍然可以访问 sharedEvents 并通过此对象发送和接收事件。



实现
    public function get sharedEvents():EventDispatcher

swfVersion

属性 
swfVersion:uint  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0, Flash Player 9, Flash Lite 4

已加载的 SWF 文件的文件格式版本。使用 SWFVersion 类(如 SWFVersion.FLASH7SWFVersion.FLASH9)中的枚举指定文件格式。



实现
    public function get swfVersion():uint

引发
Error — 如果文件未完整下载,不足以检索到所请求的信息。
 
Error — 如果文件不是 SWF 文件。

相关 API 元素

uncaughtErrorEvents

属性 
uncaughtErrorEvents:UncaughtErrorEvents  [只读]

语言版本: ActionScript 3.0
运行时版本: Flash Player 10.1, AIR 2

一个在此 LoaderInfo 对象的 SWF 文件中的代码中发生无法处理的错误时调度 uncaughtError 事件的对象。当任何 try..catch 块引发错误时,或调度的 ErrorEvent 对象没有注册的侦听器时,会发生未被捕获的错误。

例如,如果在 try 块中具有调用其事件处理函数的事件调度函数,则 catch 块不会捕获在事件处理函数中引发的错误。随后引发的任何错误可以通过侦听 LoaderInfo.uncaughtErrorEvents 来捕获。

当与此 LoaderInfo 关联的 SWF 完成加载时,会创建此属性。在此之前,uncaughtErrorEvents 属性保持为 null。在只包含 ActionScript 的项目中,可以在 SWF 文件主类的构造函数执行期间或执行后访问此属性。对于 Flex 项目,uncaughtErrorEvents 属性在调度 applicationComplete 事件之后可用。



实现
    public function get uncaughtErrorEvents():UncaughtErrorEvents

相关 API 元素


示例  ( 如何使用本示例 )
以下示例演示了使用未被捕获的错误事件处理程序检测 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!");
        }
    }
}


以下示例是与上述示例相同的 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>

url

属性 
url:String  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0, Flash Player 9, Flash Lite 4

所加载媒体的 URL。

在此 LoaderInfo 对象的对应 Loader 对象调度第一个 progress 事件之前,url 属性的值可能只反映在对 Loader 对象的 load() 方法的调用中指定的初始 URL。在第一个 progress 事件之后,url 属性将在解析了任何重定向和相对 URL 后反映媒体的最终 URL。

在某些情况下,url 属性的值会被截断;有关详细信息,请参阅 isURLInaccessible 属性。



实现
    public function get url():String

相关 API 元素

width

属性 
width:int  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0, Flash Player 9, Flash Lite 4

被加载内容的标示的宽度。此值可能与所显示内容的实际宽度不同,因为被加载的内容或其父显示对象可能被缩放。



实现
    public function get width():int

引发
Error — 如果文件未完整下载,不足以检索到所请求的信息。
方法详细信息

getLoaderInfoByDefinition

()方法
public static function getLoaderInfoByDefinition(object:Object):LoaderInfo

语言版本: ActionScript 3.0
运行时版本: AIR 1.0, Flash Player 9.0.115.0, Flash Lite 4

返回与定义为对象的 SWF 文件相关联的 LoaderInfo 对象。

参数

object:Object — 要为其获取关联 LoaderInfo 对象的对象。

返回
LoaderInfo — 关联的 LoaderInfo 对象。当在非调试器构建中调用时(或未启用调试时),或当引用的 object 没有相关联的 LoaderInfo 对象(比如由 AIR 运行时使用的某些对象)时,返回 null

引发
SecurityError — 调用方不在本地受信任沙箱中运行。
事件详细信息

complete

事件
事件对象类型: flash.events.Event
属性 Event.type = flash.events.Event.COMPLETE

语言版本: ActionScript 3.0
运行时版本: AIR 1.0, Flash Player 9, Flash Lite 4

成功加载数据后调度。也就是说,当已下载所有内容并且已完成加载过程时调度它。complete 事件始终在 init 事件之后调度。当该对象已做好访问准备(尽管可能仍在下载内容)时,将调度 init 事件。

Event.COMPLETE 常量定义 complete 事件对象的 type 属性值。

此事件具有以下属性:

属性
bubblesfalse
cancelablefalse;没有要取消的默认行为。
currentTarget当前正在使用某个事件侦听器处理 Event 对象的对象。
target已完成加载的网络对象。

相关 API 元素

httpStatus

事件  
事件对象类型: flash.events.HTTPStatusEvent
属性 HTTPStatusEvent.type = flash.events.HTTPStatusEvent.HTTP_STATUS

语言版本: ActionScript 3.0
运行时版本: AIR 1.0, Flash Player 9, Flash Lite 4

在通过 HTTP 发出网络请求并且可以检测到 HTTP 状态代码时调度。

HTTPStatusEvent.HTTP_STATUS 常量定义 httpStatus 事件对象的 type 属性值。

此事件具有以下属性:

属性
bubblesfalse
cancelablefalse;没有要取消的默认行为。
currentTarget当前正在使用某个事件侦听器处理 Event 对象的对象。
status由服务器返回的 HTTP 状态代码。
target接收 HTTP 状态代码的网络对象。

相关 API 元素

init

事件  
事件对象类型: flash.events.Event
属性 Event.type = flash.events.Event.INIT

语言版本: ActionScript 3.0
运行时版本: AIR 1.0, Flash Player 9, Flash Lite 4

当已加载的 SWF 文件的属性和方法可供访问并做好使用准备时进行调度。不过,内容可能仍在下载之中。如果存在以下条件,则 LoaderInfo 对象将调度 init 事件:

  • 可以访问与加载的对象关联的所有属性和方法以及与 LoaderInfo 对象关联的属性和方法。
  • 所有子对象的构造函数已完成。
  • 已执行所加载的 SWF 主时间轴的第一帧中的所有 ActionScript 代码。

例如,在加载影片或动画的第一帧时将调度 Event.INIT。然后,影片将可供访问并可添加到显示列表中。不过,下载完整的影片可能需要花更长的时间。只有在加载了完整的影片之后才会调度 Event.COMPLETE

init 事件始终在 complete 事件之前。

Event.INIT 常量定义 init 事件对象的 type 属性值。

此事件具有以下属性:

属性
bubblesfalse
cancelablefalse;没有要取消的默认行为。
currentTarget当前正在使用某个事件侦听器处理 Event 对象的对象。
target与所加载的 SWF 文件相关联的 LoaderInfo 对象。

相关 API 元素

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要显示为错误消息的文本。

相关 API 元素

open

事件  
事件对象类型: flash.events.Event
属性 Event.type = flash.events.Event.OPEN

语言版本: ActionScript 3.0
运行时版本: AIR 1.0, Flash Player 9, Flash Lite 4

在加载操作开始时调度。

Event.OPEN 常量用于定义 open 事件对象的 type 属性值。

此事件具有以下属性:

属性
bubblesfalse
cancelablefalse;没有要取消的默认行为。
currentTarget当前正在使用某个事件侦听器处理 Event 对象的对象。
target已打开连接的网络对象。

相关 API 元素

progress

事件  
事件对象类型: flash.events.ProgressEvent
属性 ProgressEvent.type = flash.events.ProgressEvent.PROGRESS

语言版本: ActionScript 3.0
运行时版本: AIR 1.0, Flash Player 9, Flash Lite 4

在下载操作过程中收到数据时调度。

定义 progress 事件对象的 type 属性值。

此事件具有以下属性:

属性
bubblesfalse
bytesLoaded在侦听器处理事件时加载的项数或字节数。
bytesTotal如果加载进程成功,最终将加载的项目或字节总数。
cancelablefalse;没有要取消的默认行为。
currentTarget当前正在使用某个事件侦听器处理 Event 对象的对象。
target报告进度的对象。

相关 API 元素

unload

事件  
事件对象类型: flash.events.Event
属性 Event.type = flash.events.Event.UNLOAD

语言版本: ActionScript 3.0
运行时版本: AIR 1.0, Flash Player 9, Flash Lite 4

当使用 Loader 对象的 unload() 方法删除已加载对象时,或者当同一 Loader 对象执行第二次加载并且在加载开始之前删除了原始内容时,由 LoaderInfo 对象调度。

Event.UNLOAD 常量定义 unload 事件对象的 type 属性值。

此事件具有以下属性:

属性
bubblesfalse
cancelablefalse;没有要取消的默认行为。
currentTarget当前正在使用某个事件侦听器处理 Event 对象的对象。
targetLoaderInfo 对象与将被卸载或替换的 SWF 文件相关联。

相关 API 元素

LoaderInfoExample.as

下例使用 LoaderInfoExample 类在舞台上显示一幅图像。执行下列步骤可完成此操作:
  1. 属性 url被创建,该属性是图像的位置和名称。
  2. 类构造函数创建一个名为 loader 的 Loader 对象。
  3. loader 对象将事件侦听器进行实例化,以确保图像正确加载。
  4. 构造函数创建一个 URLRequest 对象的新实例 request,该实例带有传递的 url,这样,就可以知道文件的名称和位置。
  5. 然后,request 对象被传递给 loader 对象的 load() 方法,该方法会将图像加载到显示列表上。

重要提示:该示例要求您在编译的 SWF 文件所在的目录中添加一个名为 Image.gif 的文件。使用具有一个适合主 SWF 文件尺寸的区域的图像。

package {
    import flash.display.Loader;
    import flash.display.LoaderInfo;
    import flash.display.Sprite;
    import flash.events.*;
    import flash.net.URLRequest;

    public class LoaderInfoExample extends Sprite {
        private var url:String = "Image.gif";

        public function LoaderInfoExample() {
            var loader:Loader = new Loader();
            loader.contentLoaderInfo.addEventListener(Event.INIT, initHandler);
            loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
            var request:URLRequest = new URLRequest(url);
            loader.load(request);
            addChild(loader);
        }

        private function initHandler(event:Event):void {
            var loader:Loader = Loader(event.target.loader);
            var info:LoaderInfo = LoaderInfo(loader.contentLoaderInfo);
            trace("initHandler: loaderURL=" + info.loaderURL + " url=" + info.url);
        }

        private function ioErrorHandler(event:IOErrorEvent):void {
            trace("ioErrorHandler: " + event);
        }
    }
}




[ X ]为什么显示为英语?
《ActionScript 3.0 参考》中的内容以英语显示

《ActionScript 3.0 参考》中的部分内容未翻译成所有语言。当某个语言元素未翻译时,将显示为英语。例如,ga.controls.HelpBox 类未翻译成任何语言。因此在简体中文版的参考中,ga.controls.HelpBox 类显示为英语。