Why not make the default visible = false, then in the after you set the size to 0. make it visible = true. then use the resize effect.
Thanks, but the element I want to animate comes between 2 other components and I wanted it to "grow" between them rather than just abrupty make space for itself in which to grow.
I managed to do what I want with a hard coded height, but I don't like that.
I still need to get the height of the component before showing it or including it in layout.
if i understand your question correctly you have a custom component that you build and you would like to actually animate the height of that component.
you must give the component a minheight property so that flex atleast knows what the component should be when placed on the display list.
Another tip I would offer you is setting a function and using the timerevent on the creation complete. wait 1 or 2 seconds or even 30 milliseconds to run your resize function and this would make your transition look smoother.
I hope that helps.
I could set a minHeight, but it won't really help because I don't know the height I want to resize to.
I need a way to get the height of the component, I would have thought that creationComplete is fired after laying out children and measuring, but guess not.
You can use getPreferredBoundsHeight() to get the preferred height, then animate to that value after creation complete. You may need to store the value before setting the height to 0. I'm pretty sure explicitly setting the height affects the preferred height...
I am setting this.height=0 in the initialize handler.
I'll try getPreferredBoundsHeight() before that in the init handler, but it's probably too soon.
There's a flicker if I set this.height=0 in creationComplete and this.height returns 0 when includeInLayout is false, but maybe getPreferredBoundsHeight() works with includeInLayout false.
I'll give it a go.