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
flash.geom 

Matrix3D  - AS3

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
Packageflash.geom
Classpublic class Matrix3D
InheritanceMatrix3D Inheritance Object

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

The Matrix3D class represents a transformation matrix that determines the position and orientation of a three-dimensional (3D) display object. The matrix can perform transformation functions including translation (repositioning along the x, y, and z axes), rotation, and scaling (resizing). The Matrix3D class can also perform perspective projection, which maps points from the 3D coordinate space to a two-dimensional (2D) view.

A single matrix can combine multiple transformations and apply them at once to a 3D display object. For example, a matrix can be applied to 3D coordinates to perform a rotation followed by a translation.

When you explicitly set the z property or any of the rotation or scaling properties of a display object, a corresponding Matrix3D object is automatically created.

You can access a 3D display object's Matrix3D object through the transform.matrix3d property. 2D objects do not have a Matrix3D object.

The value of the z property of a 2D object is zero and the value of its matrix3D property is null.

Note: If the same Matrix3D object is assigned to two different display objects, a runtime error is thrown.

The Matrix3D class uses a 4x4 square matrix: a table of four rows and columns of numbers that hold the data for the transformation. The first three rows of the matrix hold data for each 3D axis (x,y,z). The translation information is in the last column. The orientation and scaling data are in the first three columns. The scaling factors are the diagonal numbers in the first three columns. Here is a representation of Matrix3D elements:

Matrix3D elements

You don't need to understand matrix mathematics to use the Matrix3D class. It offers specific methods that simplify the task of transformation and projection, such as the appendTranslation(), appendRotation(), or interpolateTo() methods. You also can use the decompose() and recompose() methods or the rawData property to access the underlying matrix elements.

Display objects cache their axis rotation properties to have separate rotation for each axis and to manage the different combinations of rotations. When a method of a Matrix3D object is called to transform a display object, the rotation cache of the object is invalidated.

More examples

Related API Elements



Public Properties
 PropertyDefined By
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
  determinant : Number
[read-only] A Number that determines whether a matrix is invertible.
Matrix3D
  position : Vector3D
A Vector3D object that holds the position, the 3D coordinate (x,y,z) of a display object within the transformation's frame of reference.
Matrix3D
  rawData : Vector.<Number>
A Vector of 16 Numbers, where every four elements is a column of a 4x4 matrix.
Matrix3D
Public Methods
 MethodDefined By
  
Matrix3D(v:Vector.<Number> = null)
Creates a Matrix3D object.
Matrix3D
  
Appends the matrix by multiplying another Matrix3D object by the current Matrix3D object.
Matrix3D
  
appendRotation(degrees:Number, axis:Vector3D, pivotPoint:Vector3D = null):void
Appends an incremental rotation to a Matrix3D object.
Matrix3D
  
appendScale(xScale:Number, yScale:Number, zScale:Number):void
Appends an incremental scale change along the x, y, and z axes to a Matrix3D object.
Matrix3D
  
Appends an incremental translation, a repositioning along the x, y, and z axes, to a Matrix3D object.
Matrix3D
  
Returns a new Matrix3D object that is an exact copy of the current Matrix3D object.
Matrix3D
  
copyColumnFrom(column:uint, vector3D:Vector3D):void
Copies a Vector3D object into specific column of the calling Matrix3D object.
Matrix3D
  
copyColumnTo(column:uint, vector3D:Vector3D):void
Copies specific column of the calling Matrix3D object into the Vector3D object.
Matrix3D
  
copyFrom(sourceMatrix3D:Matrix3D):void
Copies all of the matrix data from the source Matrix3D object into the calling Matrix3D object.
Matrix3D
  
copyRawDataFrom(vector:Vector.<Number>, index:uint = 0, transpose:Boolean = false):void
Copies all of the vector data from the source vector object into the calling Matrix3D object.
Matrix3D
  
copyRawDataTo(vector:Vector.<Number>, index:uint = 0, transpose:Boolean = false):void
Copies all of the matrix data from the calling Matrix3D object into the provided vector.
Matrix3D
  
copyRowFrom(row:uint, vector3D:Vector3D):void
Copies a Vector3D object into specific row of the calling Matrix3D object.
Matrix3D
  
copyRowTo(row:uint, vector3D:Vector3D):void
Copies specific row of the calling Matrix3D object into the Vector3D object.
Matrix3D
  
Matrix3D
  
decompose(orientationStyle:String = "eulerAngles"):Vector.<Vector3D>
Returns the transformation matrix's translation, rotation, and scale settings as a Vector of three Vector3D objects.
Matrix3D
  
Uses the transformation matrix without its translation elements to transform a Vector3D object from one space coordinate to another.
Matrix3D
 Inherited
Indicates whether an object has a specified property defined.
Object
  
Converts the current matrix to an identity or unit matrix.
Matrix3D
  
interpolate(thisMat:Matrix3D, toMat:Matrix3D, percent:Number):Matrix3D
[static] Interpolates the translation, rotation, and scale transformation of one matrix toward those of the target matrix.
Matrix3D
  
Interpolates this matrix towards the translation, rotation, and scale transformations of the target matrix.
Matrix3D
  
Inverts the current matrix.
Matrix3D
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
  
pointAt(pos:Vector3D, at:Vector3D = null, up:Vector3D = null):void
Rotates the display object so that it faces a specified position.
Matrix3D
  
Prepends a matrix by multiplying the current Matrix3D object by another Matrix3D object.
Matrix3D
  
prependRotation(degrees:Number, axis:Vector3D, pivotPoint:Vector3D = null):void
Prepends an incremental rotation to a Matrix3D object.
Matrix3D
  
prependScale(xScale:Number, yScale:Number, zScale:Number):void
Prepends an incremental scale change along the x, y, and z axes to a Matrix3D object.
Matrix3D
  
Prepends an incremental translation, a repositioning along the x, y, and z axes, to a Matrix3D object.
Matrix3D
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
  
recompose(components:Vector.<Vector3D>, orientationStyle:String = "eulerAngles"):Boolean
Sets the transformation matrix's translation, rotation, and scale settings.
Matrix3D
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
 Inherited
Returns the string representation of the specified object.
Object
  
Uses the transformation matrix to transform a Vector3D object from one space coordinate to another.
Matrix3D
  
Uses the transformation matrix to transform a Vector of Numbers from one coordinate space to another.
Matrix3D
  
Converts the current Matrix3D object to a matrix where the rows and columns are swapped.
Matrix3D
 Inherited
Returns the primitive value of the specified object.
Object
Property Detail

determinant

property
determinant:Number  [read-only]

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

A Number that determines whether a matrix is invertible.

A Matrix3D object must be invertible. You can use the determinant property to make sure that a Matrix3D object is invertible. If determinant is zero, an inverse of the matrix does not exist. For example, if an entire row or column of a matrix is zero or if two rows or columns are equal, the determinant is zero. Determinant is also used to solve a series of equations.

Only a square matrix, like the Matrix3D class, has a determinant.



Implementation
    public function get determinant():Number

Related API Elements

position

property 
position:Vector3D

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

A Vector3D object that holds the position, the 3D coordinate (x,y,z) of a display object within the transformation's frame of reference. The position property provides immediate access to the translation vector of the display object's matrix without needing to decompose and recompose the matrix.

With the position property, you can get and set the translation elements of the transformation matrix.



Implementation
    public function get position():Vector3D
    public function set position(value:Vector3D):void

Related API Elements

rawData

property 
rawData:Vector.<Number>

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

A Vector of 16 Numbers, where every four elements is a column of a 4x4 matrix.

An exception is thrown if the rawData property is set to a matrix that is not invertible. The Matrix3D object must be invertible. If a non-invertible matrix is needed, create a subclass of the Matrix3D object.



Implementation
    public function get rawData():Vector.<Number>
    public function set rawData(value:Vector.<Number>):void

Related API Elements

Constructor Detail

Matrix3D

()Constructor
public function Matrix3D(v:Vector.<Number> = null)

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

Creates a Matrix3D object. Matrix3D objects can be initialized with a Vector of 16 Numbers, where every four elements is a column. Once the Matrix3D object is created, you can access its matrix elements with the rawData property.

If no parameter is defined, the constructor produces an identity or unit Matrix3D object. In matrix notation, an identity matrix has a value of one for all elements on the main diagonal position and a value of zero for all other elements. The value of the rawData property of an identity matrix is: 1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1. The position or translation value of the identity matrix is Vector3D(0,0,0), the rotation setting is Vector3D(0,0,0), and the scale value is Vector3D(1,1,1).

Parameters
v:Vector.<Number> (default = null) — A Vector of 16 Numbers, where each four elements is a column of a 4x4 matrix.

Related API Elements

Method Detail

append

()method
public function append(lhs:Matrix3D):void

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

Appends the matrix by multiplying another Matrix3D object by the current Matrix3D object. The result combines both matrix transformations. You can multiply a Matrix3D object by many matrixes. The final Matrix3D object contains the result of all the transformations.

Matrix multiplication is different from matrix addition. Matrix multiplication is not commutative. In other words, A times B is not equal to B times A. With the append() method, the multiplication happens from the left side, meaning the lhs Matrix3D object is on the left side of the multiplication operator.

thisMatrix = lhs * thisMatrix;

The first time the append() method is called, it makes a modification relative to the parent space. Subsequent calls are relative to the frame of reference of the appended Matrix3D object.

The append() method replaces the current matrix with the appended matrix. If you want to append two matrixes without altering the current matrix, copy the current matrix by using the clone() method and then apply the append() method to the copy.

Parameters

lhs:Matrix3D — A left-hand-side matrix that is multiplied by the current Matrix3D object.

Related API Elements

appendRotation

()method 
public function appendRotation(degrees:Number, axis:Vector3D, pivotPoint:Vector3D = null):void

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

Appends an incremental rotation to a Matrix3D object. When the Matrix3D object is applied to a display object, the matrix performs the rotation after other transformations in the Matrix3D object.

The display object's rotation is defined by an axis, an incremental degree of rotation around the axis, and an optional pivot point for the center of the object's rotation. The axis can be any general direction. The common axes are the X_AXIS (Vector3D(1,0,0)), Y_AXIS (Vector3D(0,1,0)), and Z_AXIS (Vector3D(0,0,1)). In aviation terminology, the rotation about the y axis is called yaw. The rotation about the x axis is called pitch. The rotation about the z axis is called roll.

The order of transformation matters. A rotation followed by a translation transformation produces a different effect than a translation followed by a rotation transformation.

The rotation effect is not absolute. It is relative to the current position and orientation. To make an absolute change to the transformation matrix, use the recompose() method. The appendRotation() method is also different from the axis rotation property of the display object, such as rotationX property. The rotation property is always performed before any translation, whereas the appendRotation() method is performed relative to what is already in the matrix. To make sure that you get a similar effect as the display object's axis rotation property, use the prependRotation() method, which performs the rotation before other transformations in the matrix.

When the appendRotation() method's transformation is applied to a Matrix3D object of a display object, the cached rotation property values of the display object are invalidated.

One way to have a display object rotate around a specific point relative to its location is to set the translation of the object to the specified point, rotate the object using the appendRotation() method, and translate the object back to the original position. In the following example, the myObject 3D display object makes a y-axis rotation around the coordinate (10,10,0).

    
    myObject.z = 1; 
    myObject.transform.matrix3D.appendTranslation(10,10,0);
    myObject.transform.matrix3D.appendRotation(1, Vector3D.Y_AXIS);
    myObject.transform.matrix3D.appendTranslation(-10,-10,0);
     
    

Parameters

degrees:Number — The degree of the rotation.
 
axis:Vector3D — The axis or direction of rotation. The usual axes are the X_AXIS (Vector3D(1,0,0)), Y_AXIS (Vector3D(0,1,0)), and Z_AXIS (Vector3D(0,0,1)). This vector should have a length of one.
 
pivotPoint:Vector3D (default = null) — A point that determines the center of an object's rotation. The default pivot point for an object is its registration point.

Related API Elements

appendScale

()method 
public function appendScale(xScale:Number, yScale:Number, zScale:Number):void

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

Appends an incremental scale change along the x, y, and z axes to a Matrix3D object. When the Matrix3D object is applied to a display object, the matrix performs the scale changes after other transformations in the Matrix3D object. The default scale factor is (1.0, 1.0, 1.0).

The scale is defined as a set of three incremental changes along the three axes (x,y,z). You can multiply each axis with a different number. When the scale changes are applied to a display object, the object's size increases or decreases. For example, setting the x, y, and z axes to two doubles the size of the object, while setting the axes to 0.5 halves the size. To make sure that the scale transformation only affects a specific axis, set the other parameters to one. A parameter of one means no scale change along the specific axis.

The appendScale() method can be used for resizing as well as for managing distortions, such as stretch or contract of a display object, or for zooming in and out on a location. Scale transformations are automatically performed during a display object's rotation and translation.

The order of transformation matters. A resizing followed by a translation transformation produces a different effect than a translation followed by a resizing transformation.

Parameters

xScale:Number — A multiplier used to scale the object along the x axis.
 
yScale:Number — A multiplier used to scale the object along the y axis.
 
zScale:Number — A multiplier used to scale the object along the z axis.

Related API Elements

appendTranslation

()method 
public function appendTranslation(x:Number, y:Number, z:Number):void

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

Appends an incremental translation, a repositioning along the x, y, and z axes, to a Matrix3D object. When the Matrix3D object is applied to a display object, the matrix performs the translation changes after other transformations in the Matrix3D object.

The translation is defined as a set of three incremental changes along the three axes (x,y,z). When the transformation is applied to a display object, the display object moves from it current location along the x, y, and z axes as specified by the parameters. To make sure that the translation only affects a specific axis, set the other parameters to zero. A zero parameter means no change along the specific axis.

The translation changes are not absolute. They are relative to the current position and orientation of the matrix. To make an absolute change to the transformation matrix, use the recompose() method. The order of transformation also matters. A translation followed by a rotation transformation produces a different effect than a rotation followed by a translation.

Parameters

x:Number — An incremental translation along the x axis.
 
y:Number — An incremental translation along the y axis.
 
z:Number — An incremental translation along the z axis.

Related API Elements

clone

()method 
public function clone():Matrix3D

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

Returns a new Matrix3D object that is an exact copy of the current Matrix3D object.

Returns
Matrix3D — A new Matrix3D object that is an exact copy of the current Matrix3D object.

copyColumnFrom

()method 
public function copyColumnFrom(column:uint, vector3D:Vector3D):void

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

Copies a Vector3D object into specific column of the calling Matrix3D object.

Parameters

column:uint — The destination column of the copy.
 
vector3D:Vector3D — The Vector3D object from which to copy the data.

copyColumnTo

()method 
public function copyColumnTo(column:uint, vector3D:Vector3D):void

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

Copies specific column of the calling Matrix3D object into the Vector3D object.

Parameters

column:uint — The column from which to copy the data.
 
vector3D:Vector3D — The destination Vector3D object of the copy.

copyFrom

()method 
public function copyFrom(sourceMatrix3D:Matrix3D):void

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

Copies all of the matrix data from the source Matrix3D object into the calling Matrix3D object.

Parameters

sourceMatrix3D:Matrix3D — The Matrix3D object from which to copy the data.

copyRawDataFrom

()method 
public function copyRawDataFrom(vector:Vector.<Number>, index:uint = 0, transpose:Boolean = false):void

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

Copies all of the vector data from the source vector object into the calling Matrix3D object. The optional index parameter allows you to select any starting slot in the vector.

Parameters

vector:Vector.<Number> — The vector object from which to copy the data.
 
index:uint (default = 0)
 
transpose:Boolean (default = false)

copyRawDataTo

()method 
public function copyRawDataTo(vector:Vector.<Number>, index:uint = 0, transpose:Boolean = false):void

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

Copies all of the matrix data from the calling Matrix3D object into the provided vector. The optional index parameter allows you to select any target starting slot in the vector.

Parameters

vector:Vector.<Number> — The vector object to which to copy the data.
 
index:uint (default = 0)
 
transpose:Boolean (default = false)

copyRowFrom

()method 
public function copyRowFrom(row:uint, vector3D:Vector3D):void

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

Copies a Vector3D object into specific row of the calling Matrix3D object.

Parameters

row:uint — The row from which to copy the data to.
 
vector3D:Vector3D — The Vector3D object from which to copy the data.

copyRowTo

()method 
public function copyRowTo(row:uint, vector3D:Vector3D):void

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

Copies specific row of the calling Matrix3D object into the Vector3D object.

Parameters

row:uint — The row from which to copy the data from.
 
vector3D:Vector3D — The Vector3D object to copy the data into.

copyToMatrix3D

()method 
public function copyToMatrix3D(dest:Matrix3D):void

Parameters

dest:Matrix3D

decompose

()method 
public function decompose(orientationStyle:String = "eulerAngles"):Vector.<Vector3D>

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

Returns the transformation matrix's translation, rotation, and scale settings as a Vector of three Vector3D objects. The first Vector3D object holds the translation elements. The second Vector3D object holds the rotation elements. The third Vector3D object holds the scale elements.

Some Matrix3D methods, such as the interpolateTo() method, automatically decompose and recompose the matrix to perform their transformation.

To modify the matrix's transformation with an absolute parent frame of reference, retrieve the settings with the decompose() method and make the appropriate changes. You can then set the Matrix3D object to the modified transformation using the recompose() method.

The decompose() method's parameter specifies the orientation style that is meant to be used for the transformation. The default orientation is eulerAngles, which defines the orientation with three separate angles of rotation for each axis. The rotations occur consecutively and do not change the axis of each other. The display object's axis rotation properties perform Euler Angles orientation style transformation. The other orientation style options are axisAngle and quaternion. The Axis Angle orientation uses a combination of an axis and an angle to determine the orientation. The axis around which the object is rotated is a unit vector that represents a direction. The angle represents the magnitude of the rotation about the vector. The direction also determines where a display object is facing and the angle determines which way is up. The appendRotation() and prependRotation() methods use the Axis Angle orientation. The quaternion orientation uses complex numbers and the fourth element of a vector. The three axes of rotation (x,y,z) and an angle of rotation (w) represent the orientation. The interpolate() method uses quaternion.

Parameters

orientationStyle:String (default = "eulerAngles") — An optional parameter that determines the orientation style used for the matrix transformation. The three types of orientation style are eulerAngles (constant EULER_ANGLES), axisAngle (constant AXIS_ANGLE), and quaternion (constant QUATERNION). For additional information on the different orientation style, see the geom.Orientation3D class.

Returns
Vector.<Vector3D> — A Vector of three Vector3D objects, each holding the translation, rotation, and scale settings, respectively.

Related API Elements


Example  ( How to use this example )

This example uses the decompose() and recompose() methods to have an ellipse stretch horizontally while moving toward the vanishing point. The first Vector3D object returned by the decompose() method holds the translation coordinates. The third Vector3D object holds the scale settings. The Vector3D object's incrementBy() method increments the matrix's absolute translation and scale settings.
package {
    import flash.display.MovieClip;
    import flash.display.Shape;
    import flash.geom.*;
    import flash.events.Event;
    
    public class Matrix3DdecomposeExample extends MovieClip {
        private var ellipse:Shape = new Shape();

        public function Matrix3DdecomposeExample():void {
            
            ellipse.x = (this.stage.stageWidth / 2);
            ellipse.y = (this.stage.stageHeight - 40);
            ellipse.z = 1;
            ellipse.graphics.beginFill(0xFF0000);
            ellipse.graphics.lineStyle(2);
            ellipse.graphics.drawEllipse(0, 0, 50, 40);
            ellipse.graphics.endFill();
            addChild(ellipse);

            ellipse.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
        }

        private function enterFrameHandler(e:Event):void {  

            var v3:Vector.<Vector3D> = new Vector.<Vector3D>(3);
            v3 = ellipse.transform.matrix3D.decompose();
            v3[0].incrementBy(new Vector3D(0,0,1));
            v3[2].incrementBy(new Vector3D(0.01,0,0));
            ellipse.transform.matrix3D.recompose(v3);
        }
    }
}

deltaTransformVector

()method 
public function deltaTransformVector(v:Vector3D):Vector3D

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

Uses the transformation matrix without its translation elements to transform a Vector3D object from one space coordinate to another. The returned Vector3D object holds the new coordinates after the rotation and scaling transformations have been applied. If the deltaTransformVector() method applies a matrix that only contains a translation transformation, the returned Vector3D is the same as the original Vector3D object.

You can use the deltaTransformVector() method to have a display object in one coordinate space respond to the rotation transformation of a second display object. The object does not copy the rotation; it only changes its position to reflect the changes in the rotation. For example, to use the display.Graphics API for drawing a rotating 3D display object, you must map the object's rotating coordinates to a 2D point. First, retrieve the object's 3D coordinates after each rotation, using the deltaTransformVector() method. Next, apply the display object's local3DToGlobal() method to translate the 3D coordinates to 2D points. You can then use the 2D points to draw the rotating 3D object.

Note: This method automatically sets the w component of the passed Vector3D to 0.0.

Parameters

v:Vector3D — A Vector3D object holding the coordinates that are going to be transformed.

Returns
Vector3D — A Vector3D object with the transformed coordinates.

Related API Elements

identity

()method 
public function identity():void

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

Converts the current matrix to an identity or unit matrix. An identity matrix has a value of one for the elements on the main diagonal and a value of zero for all other elements. The result is a matrix where the rawData value is 1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1 and the rotation setting is set to Vector3D(0,0,0), the position or translation setting is set to Vector3D(0,0,0), and the scale is set to Vector3D(1,1,1). Here is a representation of an identity matrix.

Identity Matrix

An object transformed by applying an identity matrix performs no transformation. In other words, if a matrix is multiplied by an identity matrix, the result is a matrix that is the same as (identical to) the original matrix.

interpolate

()method 
public static function interpolate(thisMat:Matrix3D, toMat:Matrix3D, percent:Number):Matrix3D

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

Interpolates the translation, rotation, and scale transformation of one matrix toward those of the target matrix.

The interpolate() method avoids some of the unwanted results that can occur when using methods such as the display object's axis rotation properties. The interpolate() method invalidates the cached value of the rotation property of the display object and converts the orientation elements of the display object's matrix to a quaternion before interpolation. This method guarantees the shortest, most efficient path for the rotation. It also produces a smooth, gimbal-lock-free rotation. A gimbal lock can occur when using Euler Angles, where each axis is handled independently. During the rotation around two or more axes, the axes can become aligned, leading to unexpected results. Quaternion rotation avoids the gimbal lock.

Consecutive calls to the interpolate() method can produce the effect of a display object starting quickly and then slowly approaching another display object. For example, if you set the thisMat parameter to the returned Matrix3D object, the toMat parameter to the target display object's associated Matrix3D object, and the percent parameter to 0.1, the display object moves ten percent toward the target object. On subsequent calls or in subsequent frames, the object moves ten percent of the remaining 90 percent, then ten percent of the remaining distance, and continues until it reaches the target.

Parameters

thisMat:Matrix3D — The Matrix3D object that is to be interpolated.
 
toMat:Matrix3D — The target Matrix3D object.
 
percent:Number — A value between 0 and 1 that determines the percent the thisMat Matrix3D object is interpolated toward the target Matrix3D object.

Returns
Matrix3D — A Matrix3D object with elements that place the values of the matrix between the original matrix and the target matrix. When the returned matrix is applied to the this display object, the object moves the specified percent closer to the target object.

Related API Elements

interpolateTo

()method 
public function interpolateTo(toMat:Matrix3D, percent:Number):void

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

Interpolates this matrix towards the translation, rotation, and scale transformations of the target matrix.

The interpolateTo() method avoids the unwanted results that can occur when using methods such as the display object's axis rotation properties. The interpolateTo() method invalidates the cached value of the rotation property of the display object and converts the orientation elements of the display object's matrix to a quaternion before interpolation. This method guarantees the shortest, most efficient path for the rotation. It also produces a smooth, gimbal-lock-free rotation. A gimbal lock can occur when using Euler Angles, where each axis is handled independently. During the rotation around two or more axes, the axes can become aligned, leading to unexpected results. Quaternion rotation avoids the gimbal lock.

Note: In case of interpolation, the scaling value of the matrix will reset and the matrix will be normalized.

Consecutive calls to the interpolateTo() method can produce the effect of a display object starting quickly and then slowly approaching another display object. For example, if the percent parameter is set to 0.1, the display object moves ten percent toward the target object specified by the toMat parameter. On subsequent calls or in subsequent frames, the object moves ten percent of the remaining 90 percent, then ten percent of the remaining distance, and continues until it reaches the target.

Parameters

toMat:Matrix3D — The target Matrix3D object.
 
percent:Number — A value between 0 and 1 that determines the location of the display object relative to the target. The closer the value is to 1.0, the closer the display object is to its current position. The closer the value is to 0, the closer the display object is to the target.

Related API Elements


Example  ( How to use this example )

In this example, ellipse2, a three-dimensional display object, goes toward ellipse1, another three-dimensional display object. ellipse2 follows ellipse1 around trying to catch it. If ellipse1 does not rotate around its y axis, ellipse2 will reach and land on top of ellipse1. The two ellipses are drawn in the same way but are placed in different three-dimensional world-space locations.
package {
    import flash.display.MovieClip;
    import flash.display.Shape;
    import flash.display.Graphics;
    import flash.geom.*;
    import flash.events.Event;

    public class InterpolateToExample extends MovieClip {
        private var ellipse1:Shape = new Shape();
        private var ellipse2:Shape = new Shape();

        public function InterpolateToExample():void {

            ellipse1 = myEllipses(250, 100, 500, 0xFF0000);
            addChild(ellipse1);
            
            ellipse2 = myEllipses(-30, 120, 1, 0x00FF00);
            addChild(ellipse2);

            addEventListener(Event.ENTER_FRAME, enterFrameHandler);
        }

        private function myEllipses(x:Number, y:Number, z:Number, c:Number):Shape {
            var s:Shape = new Shape();                            
            s.x = x;
            s.y = y;
            s.z = z;
            s.graphics.beginFill(c);
            s.graphics.lineStyle(2);
            s.graphics.drawEllipse(100, 50, 100, 80);
            s.graphics.endFill();
            return s;
        }

        private function enterFrameHandler(e:Event) {
            ellipse1.rotationY += 1;

            ellipse2.transform.matrix3D.interpolateTo(ellipse1.transform.matrix3D, 0.1);
        }
    }
}

invert

()method 
public function invert():Boolean

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

Inverts the current matrix. An inverted matrix is the same size as the original but performs the opposite transformation of the original matrix. For example, if the original matrix has an object rotate around the x axis in one direction, the inverse of the matrix will have the object rotate around the axis in the opposite direction. Applying an inverted matrix to an object undoes the transformation performed by the original matrix. If a matrix is multiplied by its inverse matrix, the result is an identity matrix.

An inverse of a matrix can be used to divide one matrix by another. The way to divide matrix A by matrix B is to multiply matrix A by the inverse of matrix B. The inverse matrix can also be used with a camera space. When the camera moves in the world space, the object in the world needs to move in the opposite direction to transform from the world view to the camera or view space. For example, if the camera moves closer, the objects becomes bigger. In other words, if the camera moves down the world z axis, the object moves up world z axis.

The invert() method replaces the current matrix with an inverted matrix. If you want to invert a matrix without altering the current matrix, first copy the current matrix by using the clone() method and then apply the invert() method to the copy.

The Matrix3D object must be invertible.

Returns
Boolean — Returns true if the matrix was successfully inverted.

Related API Elements

pointAt

()method 
public function pointAt(pos:Vector3D, at:Vector3D = null, up:Vector3D = null):void

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

Rotates the display object so that it faces a specified position. This method allows for an in-place modification to the orientation. The forward direction vector of the display object (the at Vector3D object) points at the specified world-relative position. The display object's up direction is specified with the up Vector3D object.

The pointAt() method invalidates the cached rotation property value of the display object. The method decomposes the display object's matrix and modifies the rotation elements to have the object turn to the specified position. It then recomposes (updates) the display object's matrix, which performs the transformation. If the object is pointing at a moving target, such as a moving object's position, then with each subsequent call, the method has the object rotate toward the moving target.

Note: If you use the Matrix3D.pointAt() method without setting the optional parameters, a target object does not face the specified world-relative position by default. You need to set the values for at to the -y-axis (0,-1,0) and up to the -z axis (0,0,-1).

Parameters

pos:Vector3D — The world-relative position of the target object. World-relative defines the object's transformation relative to the world space and coordinates, where all objects are positioned.
 
at:Vector3D (default = null) — The object-relative vector that defines where the display object is pointing. Object-relative defines the object's transformation relative to the object space, the object's own frame of reference and coordinate system. Default value is the +y axis (0,1,0).
 
up:Vector3D (default = null) — The object-relative vector that defines "up" for the display object. If the object is drawn looking down from above, the +z axis is its "up" vector. Object-relative defines the object's transformation relative to the object space, the object's own frame of reference and coordinate system. Default value is the +z-axis (0,0,1).

Related API Elements


Example  ( How to use this example )

In this example, a triangle points and follows the path of the ellipse's movement. The ellipse and triangle are set to different locations. The ellipse then moves up toward the corner of the stage. The triangle follows the ellipse's translation changes. You can change the triangle's shape and the "at" and "up" parameters of the pointAt() to see their impacts on the triangle's movement.
package {
    import flash.display.MovieClip;
    import flash.display.Shape;
    import flash.display.Graphics;
    import flash.geom.*;
    import flash.events.Event;

    public class PointAtExample extends MovieClip {
        private var ellipse:Shape = new Shape();
        private var triangle:Shape = new Shape();

        public function PointAtExample():void {
            ellipse.graphics.beginFill(0xFF0000);
            ellipse.graphics.lineStyle(2);
            ellipse.graphics.drawEllipse(30, 40, 50, 40);
            ellipse.graphics.endFill();
            ellipse.x = 100;
            ellipse.y = 150;
            ellipse.z = 1;

            triangle.graphics.beginFill(0x0000FF);
            triangle.graphics.moveTo(0, 0);
            triangle.graphics.lineTo(40, 40);
            triangle.graphics.lineTo(80, 0);
            triangle.graphics.lineTo(0, 0);
            triangle.graphics.endFill();
            triangle.x = 200;
            triangle.y = 50;
            triangle.z = 1;

            addChild(ellipse);
            addChild(triangle);

            ellipse.addEventListener(Event.ENTER_FRAME, ellipseEnterFrameHandler);
            triangle.addEventListener(Event.ENTER_FRAME, triangleEnterFrameHandler);
        }

        private function ellipseEnterFrameHandler(e:Event) {
            if(e.target.y > 0) {
                e.target.y -= 1;
                e.target.x -= 1;
            }
        }
        
        private function triangleEnterFrameHandler(e:Event) {
            e.target.transform.matrix3D.pointAt(ellipse.transform.matrix3D.position,
                                                Vector3D.X_AXIS, Vector3D.Y_AXIS);
        }
    }
}

prepend

()method 
public function prepend(rhs:Matrix3D):void

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

Prepends a matrix by multiplying the current Matrix3D object by another Matrix3D object. The result combines both matrix transformations.

Matrix multiplication is different from matrix addition. Matrix multiplication is not commutative. In other words, A times B is not equal to B times A. With the prepend() method, the multiplication happens from the right side, meaning the rhs Matrix3D object is on the right side of the multiplication operator.

thisMatrix = thisMatrix * rhs

The modifications made by prepend() method are object-space-relative. In other words, they are always relative to the object's initial frame of reference.

The prepend() method replaces the current matrix with the prepended matrix. If you want to prepend two matrixes without altering the current matrix, first copy the current matrix by using the clone() method and then apply the prepend() method to the copy.

Parameters

rhs:Matrix3D — A right-hand-side of the matrix by which the current Matrix3D is multiplied.

Related API Elements

prependRotation

()method 
public function prependRotation(degrees:Number, axis:Vector3D, pivotPoint:Vector3D = null):void

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

Prepends an incremental rotation to a Matrix3D object. When the Matrix3D object is applied to a display object, the matrix performs the rotation before other transformations in the Matrix3D object.

The display object's rotation is defined by an axis, an incremental degree of rotation around the axis, and an optional pivot point for the center of the object's rotation. The axis can be any general direction. The common axes are the X_AXIS (Vector3D(1,0,0)), Y_AXIS (Vector3D(0,1,0)), and Z_AXIS (Vector3D(0,0,1)). In aviation terminology, the rotation about the y axis is called yaw. The rotation about the x axis is called pitch. The rotation about the z axis is called roll.

The order of transformation matters. A rotation followed by a translation transformation produces a different effect than a translation followed by a rotation.

The rotation effect is not absolute. The effect is object-relative, relative to the frame of reference of the original position and orientation. To make an absolute change to the transformation, use the recompose() method.

When the prependRotation() method's transformation is applied to a Matrix3D object of a display object, the cached rotation property values of the display object are invalidated.

One way to have a display object rotate around a specific point relative to its location is to set the translation of the object to the specified point, rotate the object using the prependRotation() method, and translate the object back to the original position. In the following example, the myObject 3D display object makes a y-axis rotation around the coordinate (10,10,0).

    
    myObject.z = 1; 
    myObject.transform.matrix3D.prependTranslation(10,10,0);
    myObject.transform.matrix3D.prependRotation(1, Vector3D.Y_AXIS);
    myObject.transform.matrix3D.prependTranslation(-10,-10,0);
     
    

Parameters

degrees:Number — The degree of rotation.
 
axis:Vector3D — The axis or direction of rotation. The usual axes are the X_AXIS (Vector3D(1,0,0)), Y_AXIS (Vector3D(0,1,0)), and Z_AXIS (Vector3D(0,0,1)). This vector should have a length of one.
 
pivotPoint:Vector3D (default = null) — A point that determines the center of rotation. The default pivot point for an object is its registration point.

Related API Elements


Example  ( How to use this example )

In this example, the user can move a mouse to rotate an ellipse around its x and y axes. The ellipse is drawn with its registration point in its center. The ellipse rotates around its y axis using the mouse's x coordinate. It rotates around its x axis using the mouse's y coordinate.
package {
    import flash.display.MovieClip;
    import flash.display.Shape;
    import flash.geom.*;
    import flash.events.MouseEvent;
    
    public class Matrix3DprependRotationExample extends MovieClip {
        private var ellipse:Shape = new Shape();

        public function Matrix3DprependRotationExample():void {

            ellipse.graphics.beginFill(0xFF0000);
            ellipse.graphics.lineStyle(2);
            ellipse.graphics.drawEllipse(-50, -40, 100, 80);
            ellipse.graphics.endFill();

            ellipse.x = (this.stage.stageWidth / 2);
            ellipse.y = (this.stage.stageHeight / 2);
            ellipse.z = 1;
            
            addChild(ellipse);

            stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
        }

        private function mouseMoveHandler(e:MouseEvent):void {
            var y:int;
            var x:int;
            
            if(e.localX > ellipse.x) {
                y = (Math.round(e.localX) / 100);   
            } else {
                y = -(Math.round(e.localX) / 10);   
            }
            
            if(e.localY > ellipse.y) {
                x = (Math.round(e.localY) / 100);
            } else {
                x = -(Math.round(e.localY) / 100);
            }
            
            ellipse.transform.matrix3D.prependRotation(y, Vector3D.Y_AXIS);
            ellipse.transform.matrix3D.prependRotation(x, Vector3D.X_AXIS);
        }
        
    }
}

prependScale

()method 
public function prependScale(xScale:Number, yScale:Number, zScale:Number):void

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

Prepends an incremental scale change along the x, y, and z axes to a Matrix3D object. When the Matrix3D object is applied to a display object, the matrix performs the scale changes before other transformations in the Matrix3D object. The changes are object-relative, relative to the frame of reference of the original position and orientation. The default scale factor is (1.0, 1.0, 1.0).

The scale is defined as a set of three incremental changes along the three axes (x,y,z). You can multiply each axis with a different number. When the scale changes are applied to a display object, the object's size increases or decreases. For example, setting the x, y, and z axes to two doubles the size of the object, while setting the axes to 0.5 halves the size. To make sure that the scale transformation only affects a specific axis, set the other parameters to one. A parameter of one means no scale change along the specific axis.

The prependScale() method can be used for resizing as well as for managing distortions, such as stretch or contract of a display object. It can also be used for zooming in and out on a location. Scale transformations are automatically performed during a display object's rotation and translation.

The order of transformation matters. A resizing followed by a translation transformation produces a different effect than a translation followed by a resizing transformation.

Parameters

xScale:Number — A multiplier used to scale the object along the x axis.
 
yScale:Number — A multiplier used to scale the object along the y axis.
 
zScale:Number — A multiplier used to scale the object along the z axis.

Related API Elements

prependTranslation

()method 
public function prependTranslation(x:Number, y:Number, z:Number):void

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

Prepends an incremental translation, a repositioning along the x, y, and z axes, to a Matrix3D object. When the Matrix3D object is applied to a display object, the matrix performs the translation changes before other transformations in the Matrix3D object.

Translation specifies the distance the display object moves from its current location along the x, y, and z axes. The prependTranslation() method sets the translation as a set of three incremental changes along the three axes (x,y,z). To have a translation change only a specific axis, set the other parameters to zero. A zero parameter means no change along the specific axis.

The translation changes are not absolute. The effect is object-relative, relative to the frame of reference of the original position and orientation. To make an absolute change to the transformation matrix, use the recompose() method. The order of transformation also matters. A translation followed by a rotation transformation produces a different effect than a rotation followed by a translation transformation. When prependTranslation() is used, the display object continues to move in the direction it is facing, regardless of the other transformations. For example, if a display object was facing toward a positive x axis, it continues to move in the direction specified by the prependTranslation() method, regardless of how the object has been rotated. To make translation changes occur after other transformations, use the appendTranslation() method.

Parameters

x:Number — An incremental translation along the x axis.
 
y:Number — An incremental translation along the y axis.
 
z:Number — An incremental translation along the z axis.

Related API Elements


Example  ( How to use this example )

In this example, the user can push an ellipse up the stage's y axis using a mouse. When the user moves the mouse over the ellipse, the ellipse jumps ten coordinates up the y axis. When the mouse moves off of the ellipse, if the ellipse has not reached the top, the ellipse again jumps ten coordinates up the y axis. Once the ellipse reaches the top, it is moved back to the bottom of the stage.
package {
    import flash.display.MovieClip;
    import flash.display.Sprite;
    import flash.geom.*;
    import flash.events.MouseEvent;

    public class Matrix3DprependTranslationExample extends MovieClip {
        private var ellipse:Sprite = new Sprite();

        public function Matrix3DprependTranslationExample():void {
            ellipse.x = this.stage.stageWidth / 2;
            ellipse.y = this.stage.stageHeight - 100;
            ellipse.z = 1;
            ellipse.graphics.beginFill(0xFF0000);
            ellipse.graphics.lineStyle(2);
            ellipse.graphics.drawEllipse(0, 0, 60, 50);
            ellipse.graphics.endFill();
            addChild(ellipse);

            ellipse.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);
            ellipse.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
        }

        private function mouseOverHandler(e:MouseEvent):void {
            if(ellipse.y > 0) { 
                ellipse.transform.matrix3D.prependTranslation(0, -10, 0);
            } 
        }
        
        private function mouseOutHandler(e:MouseEvent):void {
            if(ellipse.y > 0) { 
                ellipse.transform.matrix3D.prependTranslation(0, -10, 0);
            } else {
                ellipse.transform.matrix3D.prependTranslation(0, 
                                     (this.stage.stageHeight - 100), 0);
            }   
        }
    }
}

recompose

()method 
public function recompose(components:Vector.<Vector3D>, orientationStyle:String = "eulerAngles"):Boolean

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

Sets the transformation matrix's translation, rotation, and scale settings. Unlike the incremental changes made by the display object's rotation properties or Matrix3D object's rotation methods, the changes made by recompose() method are absolute changes. The recompose() method overwrites the matrix's transformation.

To modify the matrix's transformation with an absolute parent frame of reference, retrieve the settings with the decompose() method and make the appropriate changes. You can then set the Matrix3D object to the modified transformation using the recompose() method.

The recompose() method's parameter specifies the orientation style that was used for the transformation. The default orientation is eulerAngles, which defines the orientation with three separate angles of rotation for each axis. The rotations occur consecutively and do not change the axis of each other. The display object's axis rotation properties perform Euler Angles orientation style transformation. The other orientation style options are axisAngle and quaternion. The Axis Angle orientation uses the combination of an axis and an angle to determine the orientation. The axis around which the object is rotated is a unit vector that represents a direction. The angle represents the magnitude of the rotation about the vector. The direction also determines where a display object is facing and the angle determines which way is up. The appendRotation() and prependRotation() methods use the Axis Angle orientation. The quaternion orientation uses complex numbers and the fourth element of a vector. An orientation is represented by the three axes of rotation (x,y,z) and an angle of rotation (w). The interpolate() method uses quaternion.

Parameters

components:Vector.<Vector3D> — A Vector of three Vector3D objects that replace the Matrix3D object's translation, rotation, and scale elements.
 
orientationStyle:String (default = "eulerAngles") — An optional parameter that determines the orientation style used for the matrix transformation. The three types of orientation styles are eulerAngles (constant EULER_ANGLES), axisAngle (constant AXIS_ANGLE), and quaternion (constant QUATERNION). For additional information on the different orientation style, see the geom.Orientation3D class.

Returns
Boolean — Returns false if any of the Vector3D elements of the components Vector do not exist or are null.

Related API Elements

transformVector

()method 
public function transformVector(v:Vector3D):Vector3D

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

Uses the transformation matrix to transform a Vector3D object from one space coordinate to another. The returned Vector3D object holds the new coordinates after the transformation. All the matrix transformations including translation are applied to the Vector3D object.

If the result of the transformVector() method was applied to the position of a display object, only the display object's position changes. The display object's rotation and scale elements remain the same.

Note: This method automatically sets the w component of the passed Vector3D to 1.0.

Parameters

v:Vector3D — A Vector3D object holding the coordinates that are going to be transformed.

Returns
Vector3D — A Vector3D object with the transformed coordinates.

Related API Elements

transformVectors

()method 
public function transformVectors(vin:Vector.<Number>, vout:Vector.<Number>):void

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

Uses the transformation matrix to transform a Vector of Numbers from one coordinate space to another. The tranformVectors() method reads every three Numbers in the vin Vector object as a 3D coordinate (x,y,z) and places a transformed 3D coordinate in the vout Vector object. All the matrix transformations including translation are applied to the vin Vector object. You can use the transformVectors() method to render and transform a 3D object as a mesh. A mesh is a collection of vertices that defines the shape of the object.

Parameters

vin:Vector.<Number> — A Vector of Numbers, where every three Numbers are a 3D coordinate (x,y,z) that is going to be transformed.
 
vout:Vector.<Number> — A Vector of Numbers, where every three Numbers are a 3D transformed coordinate (x,y,z).

Related API Elements

transpose

()method 
public function transpose():void

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

Converts the current Matrix3D object to a matrix where the rows and columns are swapped. For example, if the current Matrix3D object's rawData contains the following 16 numbers, 1,2,3,4,11,12,13,14,21,22,23,24,31,32,33,34, the transpose() method reads every four elements as a row and turns the rows into columns. The result is a matrix with the rawData of: 1,11,21,31,2,12,22,32,3,13,23,33,4,14,24,34.

The transpose() method replaces the current matrix with a transposed matrix. If you want to transpose a matrix without altering the current matrix, first copy the current matrix by using the clone() method and then apply the transpose() method to the copy.

An orthogonal matrix is a square matrix whose transpose is equal to its inverse.