I would like some help regarding the following code please:
public class TestGroup extends Group
private var anim:Animate;
private var bc1:BorderContainer;
private var bc2:BorderContainer;
private var btn:Button;
public function TestGroup()
override protected function createChildren():void
bc1 = new BorderContainer();
bc1.backgroundFill = new SolidColor(0);
btn = new Button();
btn.label = "test";
btn.addEventListener(MouseEvent.CLICK, test_clickHandler, false, 0, true);
bc2 = new BorderContainer();
bc2.backgroundFill = new SolidColor(0x7A7A7A);
override protected function updateDisplayList(unscaledWidth:Number,
this.width = unscaledWidth;
this.height = unscaledHeight;
// Size everything.
// Move everything.
btn.x = 100;
private function test_clickHandler(event:Event = null):void
anim = new Animate(bc2);
anim.disableLayout = true;
var xSMP:SimpleMotionPath = new SimpleMotionPath("y", bc2.y, 100);
var widthSMP:SimpleMotionPath = new SimpleMotionPath("width", bc2.width, 225);
anim.motionPaths = new <MotionPath>[xSMP, widthSMP];
The animation "anim" does not play, from my understanding this is due to the fact I am setting the size and position of "bc2" in updateDisplayList (if the setActualSize and move of bc2 are commented the animation plays).
What I do not understand is why is the updateDisplayList called even though disableLayout has been set to true?
What is the best way to handle this? (set the size and position in createChildren...?)
I have managed to get the animations working by using a combination fo Move, Scale and Parallel, however, even using those there are two calls to "updateDisplayList" prior the animation starting (suspendBackgroundProcessing set to true on the Parallel and applyChangesPostLayout set to true on every AnimateTransform).
I would still like to know why using the MotionPaths and Animate does not work at all and why there are calls to updateDisplayList before the animation starts?
Group isn't responsible for sizing and positioning its elements, that is what the layout is responsible for. It sounds like you want to write a custom layout.
These links might be useful: