ActionScript® 3.0 Reference for the Adobe® Flash® Platform
Home  |  Hide Packages and Classes List |  Packages  |  Classes  |  What's New  |  Index  |  Appendixes

Language Reference only
Filters: AIR 32.0 and earlier, Flash Player 32.0 and earlier, Flash Lite 4
Flex 4.6 and earlier, Flash Pro CS6 and earlier
Hide Filters
 

Top Level 

Packagesx

Top Level
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

Language Elements

Global Constants
Global Functions
Operators
Statements, Keywords & Directives
Special Types

Appendixes

What's New
Compiler Errors
Compiler Warnings
Run-Time Errors
Migrating to ActionScript 3
Supported Character Sets
MXML Only Tags
Motion XML Elements
Timed Text Tags
List of deprecated elements
Accessibility Implementation Constants
How to Use ActionScript Examples
Legal notices

Top level or global functions are available in any part of a SWF file where ActionScript is used, or in any user-defined class. Most of the global functions from ActionScript 2.0 have been migrated into classes.
Global Functions
 FunctionDefined By
  
Creates a new array.
Top Level
  
Boolean(expression:Object):Boolean
Converts the expression parameter to a Boolean value and returns the value.
Top Level
  
Decodes an encoded URI into a string.
Top Level
  
Decodes an encoded URI component into a string.
Top Level
  
Encodes a string into a valid URI (Uniform Resource Identifier).
Top Level
  
Encodes a string into a valid URI component.
Top Level
  
Converts the parameter to a string and encodes it in a URL-encoded format, where most nonalphanumeric characters are replaced with % hexadecimal sequences.
Top Level
  
int(value:Number):int
Converts a given numeric value to an integer value.
Top Level
  
Returns true if the value is a finite number, or false if the value is Infinity or -Infinity.
Top Level
  
Returns true if the value is NaN(not a number).
Top Level
  
Determines whether the specified string is a valid name for an XML element or attribute.
Top Level
  
Number(expression:Object):Number
Converts a given value to a Number value.
Top Level
  
Every value in ActionScript 3.0 is an object, which means that calling Object() on a value returns that value.
Top Level
  
Converts a string to a floating-point number.
Top Level
  
parseInt(str:String, radix:uint = 0):Number
Converts a string to an integer.
Top Level
  
String(expression:Object):String
Returns a string representation of the specified parameter.
Top Level
  
trace(... arguments):void
Displays expressions, or writes to log files, while debugging.
Top Level
  
Converts a given numeric value to an unsigned integer value.
Top Level
  
Evaluates the parameter str as a string, decodes the string from URL-encoded format (converting all hexadecimal sequences to ASCII characters), and returns the string.
Top Level
  
Vector(sourceArray:Object):Vector.<T>
Creates a new Vector instance whose elements are instances of the specified data type.
Top Level
  
XML(expression:Object):XML
Converts an object to an XML object.
Top Level
  
XMLList(expression:Object):XMLList
Converts an object to an XMLList object.
Top Level


Top level or global constants are available in every script, and are visible to every Timeline and scope in your document.
Global Constants
 ConstantDefined By
  Infinity : Number
A special value representing positive Infinity.
Top Level
  -Infinity : Number
A special value representing negative Infinity.
Top Level
  NaN : Number
A special member of the Number data type that represents a value that is "not a number" (NaN).
Top Level
  undefined : *
A special value that applies to untyped variables that have not been initialized or dynamic object properties that are not initialized.
Top Level
Constant Detail

-Infinity

Constant
public const -Infinity:Number

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9

A special value representing negative Infinity. The value of this constant is the same as Number.NEGATIVE_INFINITY.

Related API Elements


Example  ( How to use this example )

The result of division by 0 is -Infinity, but only when the divisor is a negative number.
trace(0 / 0);  // NaN
trace(7 / 0);  // Infinity
trace(-7 / 0); // -Infinity


Infinity

Constant 
public const Infinity:Number

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9

A special value representing positive Infinity. The value of this constant is the same as Number.POSITIVE_INFINITY.

Related API Elements


Example  ( How to use this example )

The result of division by 0 is Infinity, but only when the divisor is a positive number.
trace(0 / 0);  // NaN
trace(7 / 0);  // Infinity
trace(-7 / 0); // -Infinity


NaN

Constant 
public const NaN:Number

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9

A special member of the Number data type that represents a value that is "not a number" (NaN). When a mathematical expression results in a value that cannot be expressed as a number, the result is NaN. The following list describes common expressions that result in NaN.

  • Division by 0 results in NaN only if the divisor is also 0. If the divisor is greater than 0, division by 0 results in Infinity. If the divisor is less than 0, division by 0 results in -Infinity;
  • Square root of a negative number;
  • The arcsine of a number outside the valid range of 0 to 1;
  • Infinity subtracted from Infinity;
  • Infinity or -Infinity divided by Infinity or -Infinity;
  • Infinity or -Infinity multiplied by 0;

The NaN value is not a member of the int or uint data types.

The NaN value is not considered equal to any other value, including NaN, which makes it impossible to use the equality operator to test whether an expression is NaN. To determine whether a number is the NaN function, use isNaN().

Related API Elements

undefined

Constant 
public const undefined:*

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9

A special value that applies to untyped variables that have not been initialized or dynamic object properties that are not initialized. In ActionScript 3.0, only variables that are untyped can hold the value undefined, which is not true in ActionScript 1.0 and ActionScript 2.0. For example, both of the following variables are undefined because they are untyped and unitialized:

  • var foo;
  • var bar:*;

The undefined value also applies to uninitialized or undefined properties of dynamic objects. For example, if an object is an instance of the Object class, the value of any dynamically added property is undefined until a value is assigned to that property.

Results vary when undefined is used with various functions:

  • The value returned by String(undefined) is "undefined" (undefined is converted to a string).
  • The value returned by Number(undefined) is NaN.
  • The value returned by int(undefined) and uint(undefined) is 0.
  • The value returned by Object(undefined) is a new Object instance.
  • When the value undefined is assigned to a typed variable, the value is converted to the default value of the data type.

Do not confuse undefined with null. When null and undefined are compared with the equality (==) operator, they compare as equal. However, when null and undefined are compared with the strict equality (===) operator, they compare as not equal.

Related API Elements


Example  ( How to use this example )

In the following example, an untyped variable, myVar is declared but not initialized. The value of myVar is undefined because the variable is untyped. This is true whether the variable has no type annotation or uses the special (*) untyped annotation (var myVar:*;).
// trace value of untyped and uninitialized variable
var myVar;
trace(myVar); // undefined

The same rule applies to uninitialized properties of a dynamic object. For example, given an instance, obj, of the dynamic class A, the value of obj.propName, which is an uninitialized property of the obj instance, is undefined.
dynamic class A {}
var obj:A = new A()

// trace undefined property of obj
trace(obj.propName); // undefined

Function detail

Array

()function
public function Array(... args):Array

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9, Flash Lite 4

Creates a new array. The array can be of length zero or more, or an array populated by a single specified object.

  • Calling Array() with no arguments returns an empty array.
  • Calling Array() with a single integer argument returns an array of the specified length, but whose elements have undefined values.
  • Calling Array() with a specified object returns an array with one element of the specified object.
Using the Array() function is similar to creating an array with the Array class constructor, but the Array() function only allows one, or no, parameter value. You cannot use the the Array() function to populate the new array with several values.

Note: If you try to use the Array() function to create a new array, and pass several values as parameters to populate the array, you'll get a compiler error. The the Array() function only allows one parameter. Use the Array class constructor, instead, to create and populate an array of several values.

The Array() function does not cast the type of an object to an array. Use the as operator for explicit type conversion, or type casting, when the argument is not a primitive value. For more information, see the Example section of this entry. If you pass an object as a parameter to the Array() function, a new array is created containing the object as an element.

Parameters

... args — You can pass no arguments for an empty array, a single integer argument for an array of a specific length, or a single object to create an array containing the one specified object.

Returns
Array — An array of length zero or more.

Related API Elements


Example  ( How to use this example )

The following example demonstrates the behavior of the Array() function when an argument is not a primitive value. A common use case of casting to an array is the conversion of an Object instance that stores its values in array format. If Array() is called with an argument of type Object, or any other non-primitive data type, a reference to the object is stored in an element of the new array. In other words, if the only argument passed is an object, a reference to that object becomes the first element of the new array.
var obj:Object = [ "a", "b", "c" ];
      
var newArray:Array = Array( obj );

trace(newArray == obj);    // false
trace(newArray[0] == obj); // true
trace(newArray[0][0])      // a
trace(newArray[0][1])      // b
trace(newArray[0][2])      // c

To cast obj to an array, use the as operator, which returns an array reference if obj is a valid array and null otherwise:
var obj:Object = [ "a", "b", "c" ];
      
var newArray:Array = obj as Array;

trace(newArray == obj); // true
trace(newArray[0]);     // a
trace(newArray[1]);     // b
trace(newArray[2]);     // c

Boolean

()function 
public function Boolean(expression:Object):Boolean

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9, Flash Lite 4

Converts the expression parameter to a Boolean value and returns the value.

The return value depends on the data type and value of the argument, as described in the following table:

Input ValueExampleReturn Value
0Boolean(0)false
NaNBoolean(NaN)false
Number (not 0 or NaN)Boolean(4)true
Empty stringBoolean("")false
Non-empty stringBoolean("6")true
nullBoolean(null)false
undefinedBoolean(undefined)false
Instance of Object classBoolean(new Object())true
No argumentBoolean()false

Unlike previous versions of ActionScript, the Boolean() function returns the same results as does the Boolean class constructor.

Parameters

expression:Object — An expression or object to convert to Boolean.

Returns
Boolean — The result of the conversion to Boolean.

decodeURI

()function 
public function decodeURI(uri:String):String

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9, Flash Lite 4

Decodes an encoded URI into a string. Returns a string in which all characters previously encoded by the encodeURI function are restored to their unencoded representation.

The following table shows the set of escape sequences that are not decoded to characters by the decodeURI function. Use decodeURIComponent() to decode the escape sequences in this table.

Escape sequences not decodedCharacter equivalents
%23#
%24$
%26&
%2B+
%2C,
%2F/
%3A:
%3B;
%3D=
%3F?
%40@

Parameters

uri:String — A string encoded with the encodeURI function.

Returns
String — A string in which all characters previously escaped by the encodeURI function are restored to their unescaped representation.

Related API Elements


Example  ( How to use this example )

package {
    import flash.display.Sprite;

    public class DecodeURIExample extends Sprite {
        public function DecodeURIExample() {
            var uri:String = "http://www.example.com/application.jsp?user=<user name='some user'></user>";
            var encoded:String = encodeURI(uri);
            var decoded:String = decodeURI(encoded);
            trace(uri);        // http://www.example.com/application.jsp?user=<user name='some user'></user>
            trace(encoded);    // http://www.example.com/application.jsp?user=%3Cuser%20name='some%20user'%3E%3C/user%3E
            trace(decoded);    // http://www.example.com/application.jsp?user=<user name='some user'></user>
        }
    }
}

decodeURIComponent

()function 
public function decodeURIComponent(uri:String):String

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9, Flash Lite 4

Decodes an encoded URI component into a string. Returns a string in which all characters previously escaped by the encodeURIComponent function are restored to their uncoded representation.

This function differs from the decodeURI() function in that it is intended for use only with a part of a URI string, called a URI component. A URI component is any text that appears between special characters called component separators (: / ; and ? ). Common examples of a URI component are "http" and "www.adobe.com".

Another important difference between this function and decodeURI() is that because this function assumes that it is processing a URI component it treats the escape sequences that represent special separator characters (; / ? : @ & = + $ , #) as regular text that should be decoded.

Parameters

uri:String — A string encoded with the encodeURIComponent function.

Returns
String — A string in which all characters previously escaped by the encodeURIComponent function are restored to their unescaped representation.

Related API Elements

encodeURI

()function 
public function encodeURI(uri:String):String

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9, Flash Lite 4

Encodes a string into a valid URI (Uniform Resource Identifier). Converts a complete URI into a string in which all characters are encoded as UTF-8 escape sequences unless a character belongs to a small group of basic characters.

The following table shows the entire set of basic characters that are not converted to UTF-8 escape sequences by the encodeURI function.

Characters not encoded
0 1 2 3 4 5 6 7 8 9
a b c d e f g h i j k l m n o p q r s t u v w x y z
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
; / ? : @ & = + $ , #
- _ . ! ~ * ' ( )

Parameters

uri:String — A string representing a complete URI.

Returns
String — A string with certain characters encoded as UTF-8 escape sequences.

Related API Elements


Example  ( How to use this example )

package {
    import flash.display.Sprite;

    public class EncodeURIExample extends Sprite {
        public function EncodeURIExample() {
            var uri:String = "http://www.example.com/application.jsp?user=<user name='some user'></user>";
            var encoded:String = encodeURI(uri);
            var decoded:String = decodeURI(encoded);
            trace(uri);        // http://www.example.com/application.jsp?user=<user name='some user'></user>
            trace(encoded);    // http://www.example.com/application.jsp?user=%3Cuser%20name='some%20user'%3E%3C/user%3E
            trace(decoded);    // http://www.example.com/application.jsp?user=<user name='some user'></user>
        }
    }
}

encodeURIComponent

()function 
public function encodeURIComponent(uri:String):String

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9, Flash Lite 4

Encodes a string into a valid URI component. Converts a substring of a URI into a string in which all characters are encoded as UTF-8 escape sequences unless a character belongs to a very small group of basic characters.

The encodeURIComponent() function differs from the encodeURI() function in that it is intended for use only with a part of a URI string, called a URI component. A URI component is any text that appears between special characters called component separators (: / ; and ? ). Common examples of a URI component are "http" and "www.adobe.com".

Another important difference between this function and encodeURI() is that because this function assumes that it is processing a URI component it treats the special separator characters (; / ? : @ & = + $ , #) as regular text that should be encoded.

The following table shows all characters that are not converted to UTF-8 escape sequences by the encodeURIComponent function.

Characters not encoded
0 1 2 3 4 5 6 7 8 9
a b c d e f g h i j k l m n o p q r s t u v w x y z
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
- _ . ! ~ * ' ( )

Parameters

uri:String

Returns
String

Related API Elements

escape

()function 
public function escape(str:String):String

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9, Flash Lite 4

Converts the parameter to a string and encodes it in a URL-encoded format, where most nonalphanumeric characters are replaced with % hexadecimal sequences. When used in a URL-encoded string, the percentage symbol (%) is used to introduce escape characters, and is not equivalent to the modulo operator (%).

The following table shows all characters that are not converted to escape sequences by the escape() function.

Characters not encoded
0 1 2 3 4 5 6 7 8 9
a b c d e f g h i j k l m n o p q r s t u v w x y z
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
@ - _ . * + /

Note: Use the encodeURIComponent() function, instead of the escape() function, to treat special separator characters (@ + /) as regular text to encode.

Parameters

str:String — The expression to convert into a string and encode in a URL-encoded format.

Returns
String — A URL-encoded string.

Related API Elements

int

()function 
public function int(value:Number):int

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9, Flash Lite 4

Converts a given numeric value to an integer value. Decimal values are truncated at the decimal point.

Parameters

value:Number — A value to be converted to an integer.

Returns
int — The converted integer value.

Related API Elements

isFinite

()function 
public function isFinite(num:Number):Boolean

Language Version: ActionScript 3.0.
Runtime Versions: AIR 1.0, Flash Player 9, Flash Lite 4

Returns true if the value is a finite number, or false if the value is Infinity or -Infinity. The presence of Infinity or -Infinity indicates a mathematical error condition such as division by 0.

Parameters

num:Number — A number to evaluate as finite or infinite.

Returns
Boolean — Returns true if it is a finite number or false if it is infinity or negative infinity

isNaN

()function 
public function isNaN(num:Number):Boolean

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9, Flash Lite 4

Returns true if the value is NaN(not a number). The isNaN() function is useful for checking whether a mathematical expression evaluates successfully to a number. The most common use of isNaN() is to check the value returned from the parseInt()and parseFloat() functions. The NaN value is a special member of the Number data type that represents a value that is "not a number."

Note: The NaN value is not a member of the int or uint data types.

The following table describes the return value of isNaN() on various input types and values. (If your compiler warnings are set to Strict Mode, some of the following operations will generate compiler warnings.)

Input Type/ValueExampleReturn Value
0 divided by 0isNaN(0/0)true
Non-zero number divided by 0isNaN(5/0)false
Square root of a negative numberisNaN(Math.sqrt(-1))true
Arcsine of number greater than 1 or less than 0isNaN(Math.asin(2))true
String that can be converted to NumberisNaN("5")false
String that cannot be converted to NumberisNaN("5a")true

Parameters

num:Number — A numeric value or mathematical expression to evaluate.

Returns
Boolean — Returns true if the value is NaN(not a number) and false otherwise.

isXMLName

()function 
public function isXMLName(str:String):Boolean

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9, Flash Lite 4

Determines whether the specified string is a valid name for an XML element or attribute.

Parameters

str:String — A string to evaluate.

Returns
Boolean — Returns true if the str argument is a valid XML name; false otherwise.

Number

()function 
public function Number(expression:Object):Number

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9, Flash Lite 4

Converts a given value to a Number value. The following table shows the result of various input types:

Input Type/ValueExampleReturn Value
undefinedNumber(undefined)NaN
nullNumber(null)0
trueNumber(true)1
falseNumber(false)0
NaNNumber(NaN)NaN
Empty stringNumber("")0
String that converts to NumberNumber("5")The number (e.g. 5)
String that does not convert to NumberNumber("5a")NaN

Parameters

expression:Object — A value to be converted to a number.

Returns
Number — The converted number value

More examples

Object

()function 
public function Object(value:Object):Object

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9, Flash Lite 4

Every value in ActionScript 3.0 is an object, which means that calling Object() on a value returns that value.

Parameters

value:Object — An object or a number, string, or Boolean value to convert.

Returns
Object — The value specified by the value parameter.

parseFloat

()function 
public function parseFloat(str:String):Number

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9, Flash Lite 4

Converts a string to a floating-point number. The function reads, or parses, and returns the numbers in a string until it reaches a character that is not a part of the initial number. If the string does not begin with a number that can be parsed, parseFloat() returns NaN. White space preceding valid integers is ignored, as are trailing nonnumeric characters.

Parameters

str:String — The string to read and convert to a floating-point number.

Returns
Number — A number or NaN (not a number).

parseInt

()function 
public function parseInt(str:String, radix:uint = 0):Number

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9, Flash Lite 4

Converts a string to an integer. If the specified string in the parameters cannot be converted to a number, the function returns NaN. Strings beginning with 0x are interpreted as hexadecimal numbers. Unlike in previous versions of ActionScript, integers beginning with 0 are not interpreted as octal numbers. You must specify a radix of 8 for octal numbers. White space and zeroes preceding valid integers are ignored, as are trailing nonnumeric characters.

Parameters

str:String — A string to convert to an integer.
 
radix:uint (default = 0) — An integer representing the radix (base) of the number to parse. Legal values are from 2 to 36.

Returns
Number — A number or NaN (not a number).

String

()function 
public function String(expression:Object):String

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9, Flash Lite 4

Returns a string representation of the specified parameter.

The following table shows the result of various input types:

Input Type/ValueReturn Value
undefinedundefined
null"null"
true"true"
false"false"
NaN"NaN"
StringString
ObjectObject.toString()
NumberString representation of the number

Parameters

expression:Object — An expression to convert to a string.

Returns
String — A string representation of the value passed for the expression parameter.

More examples

trace

()function 
public function trace(... arguments):void

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 9, AIR 1.0, Flash Lite 4

Displays expressions, or writes to log files, while debugging. A single trace statement can support multiple arguments. If any argument in a trace statement includes a data type other than a String, the trace function invokes the associated toString() method for that data type. For example, if the argument is a Boolean value the trace function invokes Boolean.toString() and displays the return value.

Parameters

... arguments — One or more (comma separated) expressions to evaluate. For multiple expressions, a space is inserted between each expression in the output.


Example  ( How to use this example )

The following example uses the class TraceExample to show how the trace() method can be used to print a simple string. Generally, the message will be printed to a "Debug" console.
package {
    import flash.display.Sprite;

    public class TraceExample extends Sprite {

        public function TraceExample() {
            trace("Hello World");
        }
    }
}

uint

()function 
public function uint(value:Number):uint

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9, Flash Lite 4

Converts a given numeric value to an unsigned integer value. Decimal values are truncated at the decimal point.

The following table describes the return value of uint() on various input types and values.

Input Type/ValueExampleReturn Value
undefineduint(undefined)0
nulluint(null)0
0uint(0)0
NaNuint(NaN)0
Positive floating-point numberuint(5.31)Truncated unsigned integer (e.g. 5)
Negative floating-point numberuint(-5.78)Truncates to integer then applies rule for negative integers
Negative integeruint(-5)Sum of uint.MAX_VALUE and the negative integer (for example, uint.MAX_VALUE + (-5))
trueuint(true)1
falseuint(false)0
Empty Stringuint("")0
String that converts to Numberuint("5")The number
String that does not convert to Numberuint("5a")0

Parameters

value:Number — A value to be converted to an integer.

Returns
uint — The converted integer value.

Related API Elements

unescape

()function 
public function unescape(str:String):String

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9, Flash Lite 4

Evaluates the parameter str as a string, decodes the string from URL-encoded format (converting all hexadecimal sequences to ASCII characters), and returns the string.

Parameters

str:String — A string with hexadecimal sequences to escape.

Returns
String — A string decoded from a URL-encoded parameter.

Vector

()function 
public function Vector(sourceArray:Object):Vector.<T>

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5, Flash Lite 4

Creates a new Vector instance whose elements are instances of the specified data type. When calling this function, you specify the data type of the result Vector's elements (the Vector's base type) using a type parameter. This function uses the same syntax that's used when declaring a Vector instance or calling the new Vector.<T>() constructor:

var v:Vector.<String> = Vector.<String>(["Hello", "World"]);

The resulting Vector is populated with the values in the elements of the sourceArray argument. If the sourceArray argument is already a Vector.<T> instance where T is the base type, the function returns that Vector. Otherwise, the result Vector is populated with the elements of the sourceArray Array or Vector.

In either case, the data type of all the elements of the sourceArray argument must match the base type T specified in the function call.

If the sourceArray argument has length 0, the function returns an empty Vector.

If a Vector is passed as the sourceArray argument and its base type is not T, or if an Array is passed and its elements are not all instances of data type T, an attempt is made to convert the values to the base type. If the values can be automatically converted, the result Vector contains the converted values. If no conversion can be made, an error occurs.

Likewise, if an element in the sourceArray argument is an instance of a subclass of the base type T, the call succeeds and the element is added to the resulting Vector. This works even if the sourceArray argument is a Vector whose base type is a subclass of T. In fact, this is the only way to convert a Vector with base type T to a Vector with a base type that's a superclass of T.

For example, the following code results in a compile error in strict mode, or a TypeError at run time, because it attempts to assign a Vector.<Sprite> to a Vector.<DisplayObject> variable (Sprite is a subclass of DisplayObject):

     var v1:Vector.<Sprite> = new Vector.<Sprite>();
     v1[0] = new Sprite();
     var v2:Vector.<DisplayObject> = v1;
     

The following alternative version of the code successfully copies the elements of a Vector.<Sprite> instance to a Vector.<DisplayObject> instance:

     var v1:Vector.<Sprite> = new Vector.<Sprite>();
     v1[0] = new Sprite();
     var v2:Vector.<DisplayObject> = Vector.<DisplayObject>(v1);
     

Parameters

sourceArray:Object — An Array or Vector instance whose elements become the elements of the result Vector. If the argument is a Vector instance whose associated data type is the same as the specified data type, the argument is returned as the function result.

Returns
Vector.<T> — A Vector instance populated with the elements of the sourceArray array.

Throws
TypeError — If the sourceArray argument contains an element that can't be converted to the specified data type.

Related API Elements

XML

()function 
public function XML(expression:Object):XML

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9, Flash Lite 4

Converts an object to an XML object.

The following table describes return values for various input types.

Parameter TypeReturn Value
BooleanValue is first converted to a string, then converted to an XML object.
NullA runtime error occurs (TypeError exception).
NumberValue is first converted to a string, then converted to an XML object.
ObjectConverts to XML only if the value is a String, Number or Boolean value. Otherwise a runtime error occurs (TypeError exception).
StringValue is converted to XML.
UndefinedA runtime error occurs (TypeError exception).
XMLInput value is returned unchanged.
XMLListReturns an XML object only if the XMLList object contains only one property of type XML. Otherwise a runtime error occurs (TypeError exception).

Parameters

expression:Object — Object to be converted to XML.

Returns
XML — An XML object containing values held in the converted object.

Learn more

Related API Elements

XMLList

()function 
public function XMLList(expression:Object):XMLList

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9, Flash Lite 4

Converts an object to an XMLList object.

The following table describes return values for various input types.

Parameter TypeReturn Value
BooleanValue is first converted to a string, then converted to an XMLList object.
NullA runtime error occurs (TypeError exception).
NumberValue is first converted to a string, then converted to an XMLList object.
ObjectConverts to XMLList only if the value is a String, Number or Boolean value. Otherwise a runtime error occurs (TypeError exception).
StringValue is converted to an XMLList object.
UndefinedA runtime error occurs (TypeError exception).
XMLValue is converted to an XMLList object.
XMLListInput value is returned unchanged.

Parameters

expression:Object — Object to be converted into an XMLList object.

Returns
XMLList — An XMLList object containing values held in the converted object.

Related API Elements