Due to style changes I am invalidating a PanelScreen class.
The Panel has a header and a button added to it.
The button is initially added in the initialize function fo the extending class of PanelScreen:
override protected function initialize() : void
{
[...]
headerProperties.leftItems = new <DisplayObject>[
mMenuButton
];
The button is displayed well until I call invalidate on the class.
The function refreshHeaderStyles calls the draw function, which calls createHeader function and I assume in this processs this is where the button gets removed from stage.
However, I am unaware of if this is done intentionally and I would somehow need to re-add the button manually or if I'am missing something else here.
Can anyone assist?
EDIT: createHeader function will actually dispose existing left,right,center Items making it impossible to re-use them. Removing these items from stage and nulling the related Vector can actually prevent this from happening and adding them back later works.
In the example below for leftItems:
override protected function createHeader() : void
{
var __header : Header;
if (header)
{
__header = header as Header;
}
if (__header && __header.leftItems)
{
__header.removeChild(mMenuButton);
__header.leftItems = null;
}
super.createHeader();
__header = header as Header;
__header.leftItems = new <DisplayObject>[mMenuButton];
}
I