Tim
Tim

Reputation: 429

how to make titleBar of Flash mx.containers.Panel invisible?

in FlashBuilder 4 beta 2, I've subclassed mx.containers.Panel, adding a public method to hide the titleBar:

    public function hideTitleBar(): void {

        if (null != this.titleBar){
            this.titleBar.visible=false;
        }
    }   

I step through the code and see that the method is being invoked and that titleBar exists, and then step through the UIComponent classes and that all looks ok too: the component is initialized and $visible is being set to false. Yet the gray bar across the top of the panel remains. I want to eliminate that bar and would be grateful for some tips on how to do that.

Upvotes: 1

Views: 4635

Answers (2)

Jude Cooray
Jude Cooray

Reputation: 19872

What I ended up doing is to set the style headerHeight to 0

this.setStyle("headerHeight", 0);

Upvotes: 4

Amarghosh
Amarghosh

Reputation: 59471

The updateDisplayList method of the Panel sets titleBar.visible to true. Subclass the Panel class, override that method, and set it to false inside that. Don't forget to call super.updateDisplayList

override protected function updateDisplayList(unscaledWidth:Number,
                                              unscaledHeight:Number):void
{
    super.updateDisplayList(unscaledWidth, unscaledHeight);
    titleBar.visible = true;
}

Upvotes: 1

Related Questions