| Package | flare.vis.controls |
| Class | public class PanZoomControl |
| Inheritance | PanZoomControl Control flash.events.EventDispatcher |
transform.matrix property) to
simulate camera movements such as panning and zooming. To pan and
zoom over a collection of objects, simply add a PanZoomControl for
the sprite holding the collection.
var s:Sprite; // a sprite holding a collection of items new PanZoomControl().attach(s); // attach pan and zoom controls to the sprite
Once a PanZoomControl has been created, panning is performed by clicking and dragging. Zooming is performed either by scrolling the mouse wheel or by clicking and dragging vertically while the control key is pressed.
By default, the PanZoomControl attaches itself to the
stage to listen for mouse events. This works fine if there
is only one collection of objects in the display list, but can cause
trouble if you want to have multiple collections that can be separately
panned and zoomed. The PanZoomControl constructor takes a second
argument that specifies a "hit area", a shape in the display list that
should be used to listen to the mouse events for panning and zooming.
For example, this could be a background sprite behind the zoomable
content, to which the "camera" sprite could be added. One can then set
the scrollRect property to add clipping bounds to the
panning and zooming region.
| Property | Defined by | ||
|---|---|---|---|
![]() | filter : Function Boolean function indicating the items considered by the control.
| Control | |
| hitArea : InteractiveObject The active hit area over which pan/zoom interactions can be performed.
| PanZoomControl | ||
![]() | object : InteractiveObject The interactive object this control is attached to.
| Control | |
| Method | Defined by | ||
|---|---|---|---|
|
PanZoomControl(hitArea:InteractiveObject = null)
Creates a new PanZoomControl.
| PanZoomControl | ||
|
attach(obj:InteractiveObject):void
Attach this control to the given interactive object.
| PanZoomControl | ||
|
detach():InteractiveObject
Detach this control.
| PanZoomControl | ||
| hitArea | property |
hitArea:InteractiveObject [read-write]The active hit area over which pan/zoom interactions can be performed.
Implementation public function get hitArea():InteractiveObject
public function set hitArea(value:InteractiveObject):void
| PanZoomControl | () | constructor |
public function PanZoomControl(hitArea:InteractiveObject = null)Creates a new PanZoomControl.
ParametershitArea:InteractiveObject (default = null) — a display object to use as the hit area for mouse
events. For example, this could be a background region over which
the panning and zooming should be done. If this argument is null,
the stage will be used.
|
| attach | () | method |
public override function attach(obj:InteractiveObject):voidAttach this control to the given interactive object. This method will automatically detach if already attached to another object.
Parametersobj:InteractiveObject — the display object to attach to
|
| detach | () | method |
public override function detach():InteractiveObjectDetach this control.
ReturnsInteractiveObject — the interactive object this control was attached to,
or null if this control was not attached.
|