Adobe FLEX 2-PROGRAMMING ACTIONSCRIPT 3.0 Manual page 194

Programming actionscript 3.0
Table of Contents

Advertisement

Rearranging display object layering
The user interface for the application includes buttons labeled Move Back, Move Down,
Move Up, and Move to Front. When the user clicks one of these buttons, the application calls
the corresponding method of the DrawingCanvas class:
, or
moveUp()
moveToFront()
following code:
public function moveToBack(shape:GeometricSprite):void
{
var index:int = this.getChildIndex(shape);
if (index > 0)
{
this.setChildIndex(shape, 0);
}
}
The method uses the
class) to position the display object in index position 0 in the child list of the DrawingCanvas
instance (
).
this
The
method works similarly, except that it decrements the index position of the
moveDown()
display object by 1 in the child list of the DrawingCanvas instance:
public function moveDown(shape:GeometricSprite):void
{
var index:int = this.getChildIndex(shape);
if (index > 0)
{
this.setChildIndex(shape, index - 1);
}
}
The
and
moveUp()
moveToFront()
methods.
moveDown()
194
Display Programming
. For example, the
method (inherited from the DisplayObjectContainer
setChildIndex()
methods work similarly to the
moveToBack()
method includes the
moveToBack()
moveToBack()
,
,
moveDown()
and

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex

Table of Contents