[AS3 only] 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);, 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:, 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.


Version: 2.1.3 updated 2019-05-18




        By using GreenSock code, you agree to the terms of use.

        Help support GreenSock by becoming a member

        Join Club GreenSock