If you're using
LiquidStage and you'd like to tween
a DisplayObject to coordinates that are relative to a particular
PinPoint
(like the
CENTER
)
whose position may change at any time,
LiquidPositionPlugin
makes it easy by dynamically updating the
destination values accordingly. For example, let's say you have an "mc" Sprite that should tween to the center of
the screen, you could do:
import com.greensock.TweenLite;
import com.greensock.layout.*;
import com.greensock.plugins.*;
TweenPlugin.activate([LiquidPositionPlugin]); //activation is permanent in the SWF, so this line only needs to be run once.
var ls:LiquidStage = new LiquidStage(this.stage, 550, 400, 550, 400);
TweenLite.to(mc, 2, {liquidPosition:{pin:ls.CENTER}});
Or to tween to exactly x:100, y:200 but have that position move with the
TOP_RIGHT
PinPoint
whenever it repositions (so they retain their relative distance from each other), the tween would look like this:
TweenLite.to(mc, 2, {liquidPosition:{x:100, y:200, pin:ls.TOP_RIGHT}});
To prevent the
LiquidPositionPlugin
from controlling the object's y property,
simply pass
ignoreY:true
in the vars object. The same goes for the x position:
ignoreX:true
.
By default,
LiquidPositionPlugin
will reconcile the position which means it will
act as though the coordinates were defined before the stage was resized (so they'd be according
to the original size at which the swf was built in the IDE). If you don't want it to reconcile,
simply pass
reconcile:false
through the vars object.
LiquidPositionPlugin is a Club GreenSock membership benefit and requires
LiquidStage.
You must have a valid membership to use this class without violating the terms of use. Visit
http://www.greensock.com/club/
to sign up or get more details.
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.