This content has been marked as final. Show 4 replies
component:CustomComponent = new CustomComponent();
component.percentWidth = 100; // not 1, but 100
component.percentHeight= 100; // ditto
Thanks Peter, but I've given that a go already.
I'm looking into trying to get the component instantiated through MXML, and then returning it using it's ID. If another container addChilds it, then the component will be removed from the (temporary) display list it was previously added to (simply for instantiating), correct?
I think these layout issues are only when I instantiate it in actionscript, but further poking should reveal the truth....
Before you can use addChild() on a component it must be removed from its current parent by using the parent's removeChild() function. In any case, the percentWidth and percentHeight values will cause the component to stretch to fill the container, providing the container allows that to happen.
It was all caused because of an override to updateDisplayList that wasn't calling super.updateDisplayList()!!
Watch yourselves with those overrides lads :)