適用於 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 標籤
移動 XML 元素
Timed Text 標籤
不建議元素清單
AccessibilityImplementation 常數
如何使用 ActionScript 範例
法律聲明

flash.utils 套件包含各種可用來計時程式碼執行、擷取類別和物件資訊,以及轉換反斜線字元的套件層級函數。
公用方法
 函數定義自
  
會取消指定的 setInterval() 呼叫。
flash.utils
  
會取消指定的 setTimeout() 呼叫。
flash.utils
  
會產生 XML 物件,以說明命名為方法之參數的 ActionScript 物件。
flash.utils
  
會根據 System.useCodePage 的值,傳回編碼為 UTF-8 或系統字碼頁之輸入字串的逸出副本。
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
  
會根據 System.useCodePage 的值,傳回透過系統字碼頁或 UTF-8 解碼之輸入字串的不逸出副本。
flash.utils
函數詳細資訊

clearInterval

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

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

會取消指定的 setInterval() 呼叫。

參數

id:uintsetInterval() 呼叫的 ID,您要將其設定為變數,如下所示:

相關 API 元素


範例  ( 如何使用本範例 )

下列範例會使用 setInterval() 方法建立計時間隔,在固定的一秒鐘間隔之後呼叫 myRepeatingFunction() 方法。

每一個 myRepeatingFunction 方法呼叫都會遞增 counter 屬性,而當它等於 stopCount 屬性時,會使用 intervalId 屬性 (它是之前建立之間隔的參照 ID) 呼叫 clearInterval() 方法。

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:uintsetTimeout() 呼叫的 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

會產生 XML 物件,以說明命名為方法之參數的 ActionScript 物件。 這個方法會實作 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常數的資料類型。
<方法> 方法是宣告為類別定義之一部分的函數。
 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

會根據 System.useCodePage 的值,傳回編碼為 UTF-8 或系統字碼頁之輸入字串的逸出副本。 使用 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"。不逸出 "Cr%C3%BCe",並將 System.useCodePage 設定為 true ,便會在不同的系統上產生不良結果,例如在拉丁系統上產生 "Crüe"。 同樣地,不逸出 "Cr%FCe" 並將 System.useCodePage 設定為 false,則可能會根據系統的字碼頁,而產生 "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() 函數則會忽略此類別物件階層架構,並傳回以更熟悉之實體階層架構為根據的父類別。 例如,儘管在技術上 String 類別物件會繼承自 Class,但是呼叫 getQualifiedSuperclassName(String) 還是會傳回 Object。 換句話說,不論您使用類型的實體或是該類型本身,結果都相同。

參數

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 的行為不同。

如需有關日曆日期 (timestamp) 的資訊,請參閱 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() 呼叫,將不會對含有設定逾時結束項函數的物件進行記憶體回收處理。

參數

closure:Function — 要執行的函數名稱。 請勿包含引號或括號,也不要指定要呼叫之函數的參數。 例如,請使用 functionName,而非 functionName()functionName(param)
 
delay:Number — 間隔,以毫秒為單位。
 
... arguments — 選擇性的引數清單,會傳遞至結束函數。

傳回值
uint — 計時程序的唯一數字識別碼。使用此識別碼呼叫 clearInterval() 方法即可取消程序。

相關 API 元素


範例  ( 如何使用本範例 )

下列範例會使用 setInterval() 方法建立計時間隔,在固定的一秒鐘間隔之後呼叫 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:Function — 要執行的函數名稱。 請勿包含引號或括號,也不要指定要呼叫之函數的參數。 例如,請使用 functionName,而非 functionName()functionName(param)
 
delay:Number — 直到函數執行之前的延遲時間,以毫秒為單位。
 
... arguments — 選擇性的引數清單,會傳遞至結束函數。

傳回值
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

會根據 System.useCodePage 的值,傳回透過系統字碼頁或 UTF-8 解碼之輸入字串的不逸出副本。 使用 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"。不逸出 "Cr%C3%BCe",並將 System.useCodePage 設定為 true,便會在不同的系統上產生不良結果,例如在拉丁系統上產生 "Crüe"。同樣地,不逸出 "Cr%FCe" 並將 System.useCodePage 設定為 false,則可能會根據系統的字碼頁,而產生 "Cre"、"Cr?e" 或其他的變化。

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

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