I've been having some trouble with this recently. If I have an object in a container centered using object.horizontalCenter = 0, how can I move it (animated) away, then back to the center? I understand it is possible using s:move and specifying xBy to move the object away, then -xBy to bring the object back. Here is an example:
<s:Move id="moveLeft" xBy="-100" /> <s:Move id="moveRight" xBy="100" /> ... //moves object to the left moveLeft.play([myObject]); //moves object back to its original position moveRight.play([myObject]);
Although this works, it gets difficult when you are dealing with multiple objects (think a stack of objects), and causes a lot of trouble when moving through multiple items in the stack at a time.
The solution I came up with is logically simple:
object A is currently centered, object B and object C are out of frame
The issue with the above solution is that the pixel values of xTo in the s:Move effect are relative to the left of the parent container. Is it possible to have the pixel values of xTo in the s:Move effect to be relative to the center of the parent container?
tl;dr How can I use <s:Move ... xTo="0" /> to center an object in a container?