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

包 flash.utils 

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.utils 包中包含多种包级函数,可用于代码执行计时、检索类和对象的相关信息以及转换转义符。
公共方法
 函数由以下参数定义
  
取消指定的 setInterval() 调用。
flash.utils
  
取消指定的 setTimeout() 调用。
flash.utils
  
生成描述 ActionScript 对象(命名为方法的参数)的 XML 对象。
flash.utils
  
返回编码为 UTF-8 或系统代码页的输入字符串的转义副本,具体取决于 System.useCodePage 的值。
flash.utils
  
返回 name 参数指定的类的类对象引用。
flash.utils
  
返回对象的完全限定类名。
flash.utils
  
返回 value 参数指定的对象的基类的完全限定类名。
flash.utils
  
用于计算相对时间。
flash.utils
  
setInterval(closure:Function, delay:Number, ... arguments):uint
以指定的间隔(以毫秒为单位)运行函数。
flash.utils
  
setTimeout(closure:Function, delay:Number, ... arguments):uint
在指定的延迟(以毫秒为单位)后运行指定的函数。
flash.utils
  
返回依据系统代码页或 UTF-8 解码的输入字符串的反向转义副本,具体取决于 System.useCodePage 的值。
flash.utils
函数详细信息

clearInterval

()函数
public function clearInterval(id:uint):void

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

取消指定的 setInterval() 调用。

参数

id:uint — 设置为变量的 setInterval() 调用的 ID,如以下代码中所示:

相关 API 元素


示例  ( 如何使用本示例 )

以下示例使用 setInterval() 方法创建一个计时间隔,以 1 秒的固定间隔调用 myRepeatingFunction() 方法。

每次调用 myRepeatingFunction 方法都会递增 counter 属性,当该属性等于 stopCount 属性时,调用 clearInterval() 方法(使用属性 intervalId 进行调用,该属性是对前面创建的间隔的引用 ID)。

package {
    import flash.display.Sprite;
    import flash.utils.*;

    public class ClearIntervalExample extends Sprite {
        private var intervalDuration:Number = 1000; // duration between intervals, in milliseconds
        private var intervalId:uint;
        private var counter:uint     = 0;
        private var stopCount:uint     = 3;
        
        public function ClearIntervalExample() {
            intervalId = setInterval(myRepeatingFunction, intervalDuration, "Hello", "World");
        }

        public function myRepeatingFunction():void {
            trace(arguments[0] + " " + arguments[1]);

            counter++;
            if(counter == stopCount) {
                trace("Clearing Interval");
                clearInterval(intervalId);    
            }
        }
    }
}

clearTimeout

()函数 
public function clearTimeout(id:uint):void

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

取消指定的 setTimeout() 调用。

参数

id:uint — 设置为变量的 setTimeout() 调用的 ID,如以下代码中所示:

相关 API 元素


示例  ( 如何使用本示例 )

以下示例使用 setTimeout() 方法在指定的延迟期之后调用另一个方法。

创建一个计数到一百万的循环。如果系统处理此请求的速度比一秒钟后到期的速度还要快,则 clearTimeout() 将删除此 setTimeout() 请求且将不会调用 myDelayedFunction()

package {
    import flash.display.Sprite;
    import flash.utils.*;

    public class ClearTimeoutExample extends Sprite {
        private var delay:Number = 1000; // delay before calling myDelayedFunction
        private var intervalId:uint;
        private var count:uint = 1000000;
        
        public function ClearTimeoutExample() {
            intervalId = setTimeout(myDelayedFunction, delay);
            startCounting();
        }

        public function startCounting():void {
            var i:uint = 0;
            do {
                if(i == count-1) {
                    clearTimeout(intervalId);
                    trace("Your computer can count to " + count + " in less than " + delay/1000 + " seconds.");    
                }
                i++;
            } while(i < count)            
        }
        
        public function myDelayedFunction():void {
            trace("Time expired.");
        }
    }
}

describeType

()函数 
public function describeType(value:*):XML

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

生成描述 ActionScript 对象(命名为方法的参数)的 XML 对象。此方法实现 ActionScript 语言的反射编程概念。

如果 value 参数是类型的实例,则返回的 XML 对象包括该类型的所有实例属性,但不包括任何静态属性。可以在解析 XML 对象时检查此条件,方法是检查 <type> 标签的 isStatic 属性的值,该值在 value 参数是类型的实例时为 false

要获取某个类型的静态属性,请为 value 参数传递该类型本身。返回的 XML 对象不仅仅包括类型的静态属性,而且还包括它的所有实例属性。实例属性嵌套在名为 <factory> 的标签内,从而与静态属性区分开来。在这种情况下,<type> 标签的 isStatic 属性为 true

注意:如果只需要遍历某个对象的继承层次结构,而不需要 describeType() 提供的其他信息,请改用 getQualifiedClassName()getQualifiedSuperclassName() 函数。

下表描述了由 describeType() 生成的 XML 对象的某些标签和属性(返回的所有类和接口名称均采用完全限定的格式):

标签属性说明
<type> XML 对象的根标签。
 nameActionScript 对象的数据类型的名称。
 baseActionScript 对象的定义类的直接超类。如果 ActionScript 对象是类对象,则值为 Class
 isDynamic如果 ActionScript 对象的定义类是动态的,则为 true;否则为 false。如果 ActionScript 对象是类对象,则值为 true,因为 Class 类是动态的。
 isFinal如果 ActionScript 对象的定义类是最终类,则为 true;否则为 false
 isStatic如果 ActionScript 对象是类对象或构造函数,则为 true;否则为 false。此属性之所以名为 isStatic,原因是:如果此属性为 true,则未嵌套在 factory 标记内的任何标签都是静态的。
<extendsClass> ActionScript 对象的定义类的每个超类都有一个单独的 extendsClass 标签。
 typeActionScript 对象的定义类扩展的超类的名称。
<implementsInterface> ActionScript 对象的定义类或其任何超类实现的每个接口都有一个单独的 implementsInterface 标签。
 typeActionScript 对象的定义类实现的接口的名称。
<accessor> 存取器是 getter 和 setter 函数定义的一个属性。
 name存取器的名称。
 access属性的访问权限。可能的值包括 readonlywriteonlyreadwrite
 type属性的数据类型。
 declaredBy包含关联的 getter 或 setter 函数的类。
<constant> 常量是用 const 语句定义的一个属性。
 name常量的名称。
 type常量的数据类型。
<method> 方法是作为类定义的一部分声明的函数。
 name方法的名称。
 declaredBy包含方法定义的类。
 returnType方法的返回值的数据类型。
<parameter> 方法定义的每个参数都有一个单独的 parameter 标签。此标签始终嵌套在 <method> 标签内。
 index一个数字,对应于参数在方法的参数列表中出现的顺序。第一个参数的值为 1。
 type参数的数据类型。
 optional如果参数是可选参数,则为 true;否则为 false
<variable> 变量是用 var 语句定义的一个属性。
 name变量的名称。
 type变量的数据类型。
<factory> 如果 ActionScript 对象是类对象或构造函数,则所有实例属性和方法均嵌套在此标签内。如果 <type> 标签的 isStatic 属性为 true,则未嵌套在 <factory> 标签内的所有属性和方法都是静态的。只有在 ActionScript 对象是类对象或构造函数时,此标签才会出现。

参数

value:* — 需要类型说明的对象。可以将任何 ActionScript 值传递给此方法,包括所有可用的 ActionScript 类型、对象实例、原始类型(如 uint)和类对象。

返回
XML — 一个 XML 对象,包含有关作为参数传入的对象的详细信息。它提供有关对象的以下信息:
  • 对象的类
  • 类的属性
  • 从类到其基类的继承树
  • 类实现的接口
  • 类的已声明实例属性
  • 类的已声明静态属性
  • 类的实例方法
  • 类的静态方法
  • (对于类的每个方法)名称、参数的数量、返回类型和参数类型

注意: describeType() 只显示公共属性和方法,而不会显示私有、在包内部或在自定义命名空间中的属性和方法。

相关 API 元素


示例  ( 如何使用本示例 )

package {
    import flash.display.Sprite;
    import flash.utils.describeType;
    
    public class DescribeTypeExample extends Sprite {
        public function DescribeTypeExample() {
            var child:Sprite = new Sprite();
            var description:XML = describeType(child);
            trace(description..accessor.@name.toXMLString());
        }
    }
}

escapeMultiByte

()函数 
public function escapeMultiByte(value:String):String

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

返回编码为 UTF-8 或系统代码页的输入字符串的转义副本,具体取决于 System.useCodePage 的值。使用 System.useCodePage 允许运行时访问在本地代码页中编码的旧内容,但仅在使用此旧代码页的系统上。例如,在使用日语默认代码页的操作系统中,只能正确转义和反向转义以 Shift-JIS 编码的日语数据。

参数

value:String — 要转义的字符串。

返回
String — 输入字符串的转义副本。如果 System.useCodePage 为 true,则转义字符串采用系统代码页编码。如果 System.useCodePage 为 false,则转义字符串采用 UTF-8 编码。例如,如果 System.useCodePage 为 false,输入字符串“Crüe”在所有系统上都将被转义为“Cr%C3%BCe”。如果 system.useCodePage 为 true,并且系统使用拉丁语代码页,则“Crüe”将被转义为“Cr%FCe”。如果系统使用不包含字母“ü”的非拉丁语代码页,结果将可能为“Cr?e”。如果在 System.useCodePage 设置为 true 的情况下对“Cr%C3%BCe”进行反向转义,则在不同的系统上会生成不同的错误结果,比如在拉丁语系统上会生成“Crüe”。同样,在 System.useCodePage 设置为 false 的情况下对“Cr%FCe”进行反向转义可能会生成“Cre”、“Cr?e”或其他变体,具体取决于系统的代码页。

getDefinitionByName

()函数 
public function getDefinitionByName(name:String):Object

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

返回 name 参数指定的类的类对象引用。

参数

name:String — 类的名称。

返回
Object — 返回 name 参数指定的类的类对象引用。

引发
ReferenceError — 不存在具有指定名称的公共定义。

示例  ( 如何使用本示例 )

以下示例使用 GetDefinitionByNameExample 类在舞台上创建一个橙色的正方形。这是使用以下步骤完成的:
  1. 声明代表橙色背景颜色和 80 像素大小的变量,这些变量稍后将用于绘制正方形。
  2. 在构造函数内,将 Class 类型的变量 ClassReference 赋予 Sprite。
  3. 对名为 instance 的 ClassReference 的实例进行实例化。
  4. 由于 instance 按引用是 Sprite 对象,因此可以使用可用于 Sprite 的方法绘制正方形并将其添加到显示列表。
package {
    import flash.display.DisplayObject;
    import flash.display.Sprite;
    import flash.utils.getDefinitionByName;

    public class GetDefinitionByNameExample extends Sprite {
        private var bgColor:uint = 0xFFCC00;
        private var size:uint = 80;

        public function GetDefinitionByNameExample() {
            var ClassReference:Class = getDefinitionByName("flash.display.Sprite") as Class;
            var instance:Object = new ClassReference();
            instance.graphics.beginFill(bgColor);
            instance.graphics.drawRect(0, 0, size, size);
            instance.graphics.endFill();
            addChild(DisplayObject(instance));
        }
    }
}

getQualifiedClassName

()函数 
public function getQualifiedClassName(value:*):String

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

返回对象的完全限定类名。

参数

value:* — 需要完全限定类名称的对象。可以将任何 ActionScript 值传递给此方法,包括所有可用的 ActionScript 类型、对象实例、原始类型(如 uint)和类对象。

返回
String — 包含完全限定类名称的字符串。

相关 API 元素

getQualifiedSuperclassName

()函数 
public function getQualifiedSuperclassName(value:*):String

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

返回 value 参数指定的对象的基类的完全限定类名。此函数检索基类名称的速度比 describeType() 快,但提供的信息不如 describeType() 全面。

使用此函数检索了类的名称后,可以用 getDefinitionByName() 函数将类名称转换为类引用。

注意:此函数将本身局限于实例层次结构,而 describeType() 函数则使用类对象层次结构(如果 value 参数是数据类型)。如果在数据类型上调用 describeType(),将会基于类对象层次结构(其中所有类对象均继承自 Class)返回超类。但是,getQualifiedSuperclassName() 函数会忽略类对象层次结构,并基于较普通的实例层次结构返回超类。例如,调用 getQualifiedSuperclassName(String) 将会返回 Object,尽管从技术角度来说 String 类对象继承自 Class。换言之,不管使用的是类型的实例还是类型本身,结果都是相同的。

参数

value:* — 任何值。

返回
String — 完全限定的基类名称,或 null(如果不存在基类名称)。

相关 API 元素

getTimer

()函数 
public function getTimer():int

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

用于计算相对时间。对于处理 ActionScript 3.0 的 Flash 运行时,此方法返回自为 ActionScript 3.0 (AVM2) 启动 Flash 运行时虚拟计算机以来经过的毫秒数。对于处理 ActionScript 2.0 的 Flash 运行时,此方法返回自 Flash 运行时开始初始化以来经过的毫秒数。Flash 运行时使用两台虚拟机处理 ActionScript。AVM1 是用于运行 ActionScript 1.0 和 2.0 的 ActionScript 虚拟机。AVM2 是用于运行 ActionScript 3.0 的 ActionScript 虚拟机。AVM1 的 getTimer() 方法行为与 AVM2 的行为不同。

关于日历日期(时间戳),请参阅 Date 对象。

返回
int — 自初始化运行时(处理 ActionScript 2.0 时)或启动虚拟计算机(处理 ActionScript 3.0 时)以来经过的毫秒数。如果运行时开始播放一个 SWF 文件,稍后再加载另一个 SWF 文件,则返回值相对于加载第一个 SWF 文件的时间。

相关 API 元素


示例  ( 如何使用本示例 )

以下示例使用 GetTimerExample 类获取和打印自运行时初始化后的毫秒数。
package {
    import flash.utils.getTimer;
    import flash.display.Sprite;

    public class GetTimerExample extends Sprite {
        public function GetTimerExample() {
            var duration:uint = getTimer();
            trace("duration: " + duration);
        }
    }
}

setInterval

()函数 
public function setInterval(closure:Function, delay:Number, ... arguments):uint

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

以指定的间隔(以毫秒为单位)运行函数。

作为使用 setInterval() 方法的替代方法,请考虑创建一个 Timer 对象,带有指定的间隔,并使用 0 作为 repeatCount 参数(这样可将计时器设置为无限制重复)。

如果打算使用 clearInterval() 方法取消 setInterval() 调用,请确保将 setInterval() 调用分配给一个变量(clearInterval() 函数稍后将引用该变量)。如果不通过调用 clearInterval() 函数取消 setInterval() 调用,则不会将包含 setTimeout 闭包函数的对象作为垃圾回收。

参数

closure:Function — 要执行的函数的名称。不要包括引号或圆括号,并且不要指定要调用的函数的参数。例如,使用 functionName,而不要使用 functionName()functionName(param)
 
delay:Number — 间隔(以毫秒为单位)。
 
... arguments — 传递给 closure 函数的可选参数列表。

返回
uint — 超时进程的唯一数字标识符。使用此标识符可通过调用 clearInterval() 方法取消进程。

相关 API 元素


示例  ( 如何使用本示例 )

以下示例使用 setInterval() 方法创建一个计时间隔,以 1 秒的固定间隔调用 myRepeatingFunction() 方法。
package {
    import flash.display.Sprite;
    import flash.utils.*;

    public class SetIntervalExample extends Sprite {
        private var intervalDuration:Number = 1000; // duration between intervals, in milliseconds
        
        public function SetIntervalExample() {
            var intervalId:uint = setInterval(myRepeatingFunction, intervalDuration, "Hello", "World");
        }

        public function myRepeatingFunction():void {
            trace(arguments[0] + " " + arguments[1]);
        }
    }
}

setTimeout

()函数 
public function setTimeout(closure:Function, delay:Number, ... arguments):uint

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

在指定的延迟(以毫秒为单位)后运行指定的函数。

作为使用此方法的替代方法,请考虑创建一个 Timer 对象,带有指定的间隔,并使用 1 作为 repeatCount 参数(这样可将计时器设置为只运行一次)。

如果打算使用 clearTimeout() 方法取消 setTimeout() 调用,请确保将 setTimeout() 调用分配给一个变量(clearTimeout() 函数稍后将引用该变量)。如果不通过调用 clearTimeout() 函数取消 setTimeout() 调用,则不会将包含设置的超时 closure 函数的对象作为垃圾回收。

参数

closure:Function — 要执行的函数的名称。不要包括引号或圆括号,并且不要指定要调用的函数的参数。例如,使用 functionName,而不要使用 functionName()functionName(param)
 
delay:Number — 执行函数之前的延迟时间(以毫秒为单位)。
 
... arguments — 传递给 closure 函数的可选参数列表。

返回
uint — 超时进程的唯一数字标识符。使用此标识符可通过调用 clearTimeout() 方法取消进程。

相关 API 元素


示例  ( 如何使用本示例 )

以下示例使用 setTimeout() 方法在指定的延迟期之后调用另一个方法。
package {
    import flash.display.Sprite;
    import flash.utils.*;

    public class SetTimeoutExample extends Sprite {
        private var delay:Number = 1000; // delay before calling myDelayedFunction
        
        public function SetTimeoutExample() {
            var intervalId:uint = setTimeout(myDelayedFunction, delay, "Hello", "World");
        }

        public function myDelayedFunction():void {
            trace(arguments[0] + " " + arguments[1]);
        }
    }
}

unescapeMultiByte

()函数 
public function unescapeMultiByte(value:String):String

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

返回依据系统代码页或 UTF-8 解码的输入字符串的反向转义副本,具体取决于 System.useCodePage 的值。使用 System.useCodePage 允许运行时访问在本地代码页中编码的旧内容,但仅在使用此旧代码页的系统上。例如,在使用日语默认代码页的操作系统中,只能正确转义和反向转义以 Shift-JIS 编码的日语数据。

参数

value:String — 要反向转义的转义字符串。

返回
String — 输入字符串的反向转义副本。如果 System.useCodePage 为 true,则依据系统代码页对转义字符串进行解码。如果 System.useCodePage 为 false,则依据 UTF-8 对转义字符串进行解码。例如,如果输入字符串为“Crüe”并且 System.useCodePage 为 false,则在所有系统上的结果都是“Crüe”。如果 System.useCodePage 为 true 且输入字符串为“Cr%FCe”,并且系统使用拉丁语代码页,则结果将也是“Crüe”。如果在 System.useCodePage 设置为 true 的情况下对“Cr%C3%BCe”进行反向转义,则在不同的系统上会生成不同的错误结果,比如在拉丁语系统上会生成“Crüe”。同样,在 System.useCodePage 设置为 false 的情况下对“Cr%FCe”进行反向转义可能会生成“Cre”、“Cr?e”或其他变体,具体取决于系统的代码页。

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

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