Packagecom.greensock.layout
Classpublic class DynamicPinPoint
InheritanceDynamicPinPoint Inheritance PinPoint Inheritance flash.geom.Point

Sometimes it's useful to have a PinPoint base its coordinates on some custom criteria, like the edge of another DisplayObject or the center of an object whose width/height changes frequently, so DynamicPinPoint allows you to associate a function (one you define) that returns a Point instance that will determine the DynamicPinPoint's x/y values. For example, to make the DynamicPinPoint position itself at the center bottom of the "video_mc" object and then attach a "mc" object, you could do this:

var pin:DynamicPinPoint = new DynamicPinPoint(video_mc, getBottomCenter);
pin.attach(mc);
function getBottomCenter():Point {
var bounds:Rectangle = video_mc.getBounds(video_mc);
return new Point(bounds.x + bounds.width / 2, bounds.y + bounds.height);
}

//if you want to initially position the "mc" object directly on the DynamicPinPoint, you could add this:
var p:Point = pin.toLocal(mc.parent);
mc.x = p.x;
mc.y = p.y;


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 Properties
 PropertyDefined by
  getter : Function
the function to be called which will return a Point object defining the new coordinates (based on the target's coordinate space)
DynamicPinPoint
Public Methods
 MethodDefined by
  
DynamicPinPoint(target:DisplayObject, getter:Function, liquidStage:LiquidStage = null)
Constructor
DynamicPinPoint
 Inherited
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
 Inherited
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
DynamicPinPoint
 Inherited
destroy():void
Destroys the PinPoint, making it eligible for garbage collection.
PinPoint
 Inherited
dispatchEvent(event:Event):Boolean
PinPoint
 Inherited
hasEventListener(type:String):Boolean
PinPoint
 Inherited
release(target:DisplayObject):Boolean
Releases a DisplayObject from being controlled by LiquidStage after having been attached.
PinPoint
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
PinPoint
 Inherited
toLocal(target:DisplayObject):Point
Determines a PinPoint's coordinates according to any DisplayObject's coordinate space.
PinPoint
 Inherited
update():void
Forces an update of LiquidStage (useful if you manually changed this PinPoint's coordinates)
PinPoint
 Inherited
willTrigger(type:String):Boolean
PinPoint
Property detail
getterproperty
getter:Function  [read-write]

the function to be called which will return a Point object defining the new coordinates (based on the target's coordinate space)

Implementation
    public function get getter():Function
    public function set getter(value:Function):void
Constructor detail
DynamicPinPoint()constructor
public function DynamicPinPoint(target:DisplayObject, getter:Function, liquidStage:LiquidStage = null)

Constructor

Parameters
target:DisplayObject — target DisplayObject who is like the "parent" of this PinPoint (its coordinate system is used for the x and y values).
 
getter:Function — the function to be called which will return a Point object defining the new coordinates (based on the target's coordinate space)
 
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
clone()method
public override function clone():Point

Returns
Point