|Class||public class PanZoomControl|
|Inheritance||PanZoomControl Control flash.events.EventDispatcher|
transform.matrixproperty) 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
scrollRect property to add clipping bounds to the
panning and zooming region.
|filter : Function|
Boolean function indicating the items considered by the control.
|hitArea : InteractiveObject|
The active hit area over which pan/zoom interactions can be performed.
|object : InteractiveObject|
The interactive object this control is attached to.
PanZoomControl(hitArea:InteractiveObject = null)
Creates a new PanZoomControl.
Attach this control to the given interactive object.
Detach this control.
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
public function PanZoomControl(hitArea:InteractiveObject = null)
Creates a new PanZoomControl.Parameters
public override function attach(obj:InteractiveObject):void
Attach this control to the given interactive object. This method will automatically detach if already attached to another object.Parameters
public override function detach():InteractiveObject
Detach this control.Returns