Packagecom.greensock.layout
Classpublic class PinPoint
InheritancePinPoint Inheritance flash.geom.Point
Implementsflash.events.IEventDispatcher
SubclassesDynamicPinPoint

PinPoint works with LiquidStage to create reference points on the stage and/or inside DisplayObjects so that the movement of these PinPoints trickles down and affects the position of attached DisplayObjects. See LiquidStage documentation for more information.

Copyright 2010, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.



Public Methods
 MethodDefined by
  
PinPoint(x:Number, y:Number, target:DisplayObject, liquidStage:LiquidStage = null)
Constructor
PinPoint
  
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Use this to add an Event.CHANGE listener to find out when the PinPoint moves.
PinPoint
  
attach(target:DisplayObject, strict:Boolean = false, reconcile:Boolean = true, tweenDuration:Number = 0, tweenVars:Object = null):void
Attaches a DisplayObject to a particular PinPoint (like TOP_RIGHT) so that any movement of the PinPoint will also affect the relative position of the DisplayObject.
PinPoint
  
clone():Point
PinPoint
  
destroy():void
Destroys the PinPoint, making it eligible for garbage collection.
PinPoint
  
dispatchEvent(event:Event):Boolean
PinPoint
  
hasEventListener(type:String):Boolean
PinPoint
  
release(target:DisplayObject):Boolean
Releases a DisplayObject from being controlled by LiquidStage after having been attached.
PinPoint
  
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
PinPoint
  
toLocal(target:DisplayObject):Point
Determines a PinPoint's coordinates according to any DisplayObject's coordinate space.
PinPoint
  
update():void
Forces an update of LiquidStage (useful if you manually changed this PinPoint's coordinates)
PinPoint
  
willTrigger(type:String):Boolean
PinPoint
Constructor detail
PinPoint()constructor
public function PinPoint(x:Number, y:Number, target:DisplayObject, liquidStage:LiquidStage = null)

Constructor

Parameters
x:Number — x coordinate
 
y:Number — y coordinate
 
target:DisplayObject — target DisplayObject who is like the "parent" of this PinPoint (its coordinate system is used for the x and y values). You can pass in the stage that is associated with a LiquidStage if you want the PinPoint to use the stage as its parent.
 
liquidStage:LiquidStage (default = null) — Optionally declare the LiquidStage instance to which this PinPoint should be associated. If none is defined, the class will try to determine the LiquidStage instance based on the target's stage property (LiquidStage.getByStage()). The only time it is useful to specifically declare the LiquidStage instance is when you plan to subload a swf that uses LiquidStage into another swf that also has a LiquidStage instance (thus they share the same stage).
Method detail
addEventListener()method
public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void

Use this to add an Event.CHANGE listener to find out when the PinPoint moves.

Parameters
type:String — Event type (Event.CHANGE)
 
listener:Function — Listener function
 
useCapture:Boolean (default = false) — useCapture
 
priority:int (default = 0) — Priority level
 
useWeakReference:Boolean (default = false) — Use weak references
attach()method 
public function attach(target:DisplayObject, strict:Boolean = false, reconcile:Boolean = true, tweenDuration:Number = 0, tweenVars:Object = null):void

Attaches a DisplayObject to a particular PinPoint (like TOP_RIGHT) so that any movement of the PinPoint will also affect the relative position of the DisplayObject. Attaching the DisplayObject does NOT force it to share the same coordinates as the PinPoint - it simply causes the PinPoint's movement to proportionally affect the position of the DisplayObject. The relationship is one-way so moving the DisplayObject will not move the PinPoint. Unless the strict parameter is true, changes are relative so you are free to move the DisplayObject as you wish and when the PinPoint's position changes, its proportional movement will honor the DisplayObject's new position instead of forcing it back to the same distance from the PinPoint. But again, you can set the strict parameter to true if you want to force the object to always maintain a certain distance from the PinPoint

For example, if your object is 100 pixels away from the PinPoint and the PinPoint moves 15 pixels, the DisplayObject will move 15 pixels as well (or however many pixels it takes to maintain its relative distance to the PinPoint which may be more or less than 15 pixels if it is nested inside a scaled parent). Strict mode, however, will force the DisplayObject to maintain its exact distance away from the PinPoint (no manual position changes will be honored when LiquidStage updates).

Parameters
target:DisplayObject — The DisplayObject to attach
 
strict:Boolean (default = false) — In strict mode, the target will be forced to remain EXACTLY the same distance from the pin as it was when it was attached. If strict is false, LiquidStage will honor any manual changes you make to the target's position, making it more flexible. Note that LiquidStage only performs updates to the target's position when the stage resizes and/or when update() is called.
 
reconcile:Boolean (default = true) — If true, the target's position will immediately be moved as far as the PinPoint has moved from its original position, effectively acting as though the target was attached BEFORE the stage was scaled. If you attach an object after the stage has been scaled and you don't want it to reconcile with the PinPoint initially, set reconcile to false.
 
tweenDuration:Number (default = 0) — To make the target tween to its new position instead of immediately moving there, set the tween duration (in seconds) to a non-zero value. A TweenLite instance will be used for the tween.
 
tweenVars:Object (default = null) — To control other aspects of the tween (like ease, onComplete, delay, etc.), use an object just like the one you'd pass into a TweenLite instance as the 3rd parameter (like {ease:Elastic.easeOut, delay:0.2})
clone()method 
public override function clone():Point

Returns
Point
destroy()method 
public function destroy():void

Destroys the PinPoint, making it eligible for garbage collection.

dispatchEvent()method 
public function dispatchEvent(event:Event):Boolean

Parameters
event:Event

Returns
Boolean
hasEventListener()method 
public function hasEventListener(type:String):Boolean

Parameters
type:String

Returns
Boolean
release()method 
public function release(target:DisplayObject):Boolean

Releases a DisplayObject from being controlled by LiquidStage after having been attached.

Parameters
target:DisplayObject — The DisplayObject to release

Returns
Boolean — if the target was found and released, this value will be true. Otherwise, it will be false.
removeEventListener()method 
public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void

Parameters
type:String
 
listener:Function
 
useCapture:Boolean (default = false)
toLocal()method 
public function toLocal(target:DisplayObject):Point

Determines a PinPoint's coordinates according to any DisplayObject's coordinate space. For example, to figure out where the CENTER PinPoint is inside the "myImage" DisplayObject, you'd do:

var point:Point = myPinPoint.toLocal(myImage);

Parameters
target:DisplayObject — DisplayObject whose coordinate space the PinPoint's position should be translated into.

Returns
Point — Point translated into the target's coordinate space.
update()method 
public function update():void

Forces an update of LiquidStage (useful if you manually changed this PinPoint's coordinates)

willTrigger()method 
public function willTrigger(type:String):Boolean

Parameters
type:String

Returns
Boolean