If you want to create and position an add new tab button to the Flex TabNavigator control that mimics Internet Explorer, you can interrogate the tab control's children to find the x position of the last child and add its width to calculate the x position of your add new button.
I use the updateComplete event to invoke a method that repositions the button:

<mx:TabNavigator width="100%"
height="100%" id="tabNavigator" creationComplete="positionAddNewTabButton()"
updateComplete="positionAddNewTabButton()">

And positionAddNewTabButton() looks like this:

public function positionAddNewTabButton():void
{
var i:int=tabNavigator.numChildren-1;
addNewTabButton.x=tabNavigator.getTabAt(i).x +
(tabNavigator.getTabAt(i).width) + 10
addNewTabButton.y=tabNavigator.getTabAt(i).y +
(tabNavigator.getTabAt(i).height/2) - 1
}

The magic number '10' fixes the space between the final tab and addNewTabButton (which is the button itself). tabNavigator is my TabNavigator.



4

View comments

About Me
About Me
Labels
Labels
Blog Archive
Loading