Hello everyone,
I have created TabNavigator as MenuBar like Microsoft Office 2007's MenuBar.
Example:
public class Main extends Application
{
public function Main():void
{
new MetalWorksDesktopTheme();
super();
}
public static var tabNavigator:TabNavigator;
override protected function initialize():void
{
super.initialize();
tabNavigator = new TabNavigator();
tabNavigator.x = tabNavigator.y = 10;
tabNavigator.addScreen("FileTab", CreateTabFile());
tabNavigator.addScreen("editTab", CreateTabEdit());
this.addChild(tabNavigator);
}
private function CreateTabFile():TabNavigatorItem
{
var content:LayoutGroup = new LayoutGroup();
content.layout = new HorizontalLayout();
content.height = 50;
var newBtn:Button = new Button();
newBtn.label = "New";
newBtn.padding = 5;
content.addChild(newBtn);
return new TabNavigatorItem(content, "File");
}
private function CreateTabEdit():TabNavigatorItem
{
var content:LayoutGroup = new LayoutGroup();
content.height = 50;
return new TabNavigatorItem(content, "Edit");;
}
....
And Resize from MainApp.as ( Flash Version ) like this static variables from Main.as ( Starling version ).
Why does TabNavigator not posit to x and y = 10 and it means Top and left corner
Show image from Google Drive
MainApp.as has onStageResizeHandler(event:Event):void
like this
private function onStageResizeHandler(event:Event):void
{
Starling.current.viewPort = new Rectangle(0, 0, stage.stageWidth, stage.stageHeight);
starling.stage.stageWidth = stage.stageWidth;
starling.stage.stageHeight = stage.stageHeight;
// Resize from Main's components
Main.tabNavigator.width = (stage.stageHeight - 20);
}
How do I fix? Thank you for explanation!