Hi guys,
I extended a collapse panel to add the contraction feature. The problem is
that before contracting the panel, its increases its size with the content.
However, after contracting the panel it restores your original size that
the content area was scrolling.That behavior happens because the height
property of the component is configured to a fixed value in the
collapseAction method. How can I restore the original height of the panel
while maintaining the the "increase with the content" behavior?
override protected function createChildren():void{
super.createChildren();
collapseButtonDown = new Button();
collapseButtonDown.width = 20;
collapseButtonDown.height = 20;
collapseButtonDown.buttonMode = true;
collapseButtonDown.useHandCursor = true;
collapseButtonDown.styleName = "collapseButtonDown";
collapseButtonDown.addEventListener(MouseEvent.CLICK,
collapseAction);
collapseButtonDown.visible = false;
collapseButtonUp = new Button();
collapseButtonUp.width = 20;
collapseButtonUp.height = 20;
collapseButtonUp.buttonMode = true;
collapseButtonUp.useHandCursor = true;
collapseButtonUp.styleName = "collapseButtonUp";
collapseButtonUp.addEventListener(MouseEvent.CLICK,
collapseAction);
ewsButton = new LinkButton();
ewsButton.label = "Send to My EWS";
ewsButton.styleName = "ewsButton";
ewsButton.width = 110;
ewsButton.height = 22;
ewsButton.visible = false;
rawChildren.addChild(collapseButtonDown);
rawChildren.addChild(collapseButtonUp);
rawChildren.addChild(ewsButton);
}
private function collapseAction(evt:MouseEvent):void{
collapseButtonUp.visible = (evt.currentTarget.styleName ==
"collapseButtonDown");
collapseButtonDown.visible = (
evt.currentTarget.styleName== "collapseButtonUp");
if(collapseButtonDown.visible){
originalHeight = height;
height = titleBar.height;
}else{
height = originalHeight;
originalHeight = 0;
}
invalidateSize();
}
Regards,
Eduardo Dias