Adobe FLEX 2-PROGRAMMING ACTIONSCRIPT 3.0 Manual page 193

Programming actionscript 3.0
Table of Contents

Advertisement

this.selectionIndicator.graphics.drawRect(-1, -1, this.size + 1,
this.size + 1);
this.addChild(this.selectionIndicator);
If this is not the first time the
selectionIndicator
follows:
this.selectionIndicator.visible = true;
The
hideSelected()
selected object by setting its
The
onMouseDown()
from the Sprite class), which includes the following code:
var boundsRect:Rectangle = this.parent.getRect(this.parent);
boundsRect.width -= this.size;
boundsRect.height -= this.size;
this.startDrag(false, boundsRect);
This lets the user drag the selected object around the canvas, within the boundaries set by the
rectangle.
boundsRect
When the user releases the mouse button, the
method of the DrawingCanvas sets up the following event listener:
this.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
This event listener is set for the DrawingCanvas object, rather than for the individual
GeometricSprite objects. This is because when the GeometricSprite object is dragged, it could
end up behind another display object (another GeometricSprite object) when the mouse is
released. The display object in the foreground would receive the mouse up event but the
display object the user is dragging would not. Adding the listener to the DrawingCanvas
object ensures that the event is always handled.
The
method calls the
onMouseUp()
which in turn calls the
onMouseDown()
shape's
property (inherited from the DisplayObject class), as
visible
method hides the
selectionIndicator
property to
visible
event handler method also calls the
onMouseUp()
method of the GeometricSprite object.
stopDrag()
method is called, the method simply sets the
shape of the previously
.
false
startDrag()
event is dispatched. The constructor
mouseUp
method of the GeometricSprite object,
Example: SpriteArranger
method (inherited
193

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex

Table of Contents