When you 'close' the tab, as I learned from Ali, you'll really have to do the following:
Set the tab's visibility to false.
Set the tab's width to 0.
However, when you resize the stage, you're going to run into another issue. Flex is going to recalculate the tabbar and then rebuild the tabs. So invisible tabs will suddenly have a new width. You'll need to add a resize handler that determines which tabs are 'closed' or by this point, for your user, since the tabs will have a visibility of false, set their size to 0 again.
Then, you'll see the tabbar freaks out and spaces the tabs in a staggered format. To get around this, your resize handler needs to get a width to set the size of the tabbar. I'd use the width of the parent tabnavigator and do the following:
-----------------------------------------------------------------------------------
view.appView['tabBar'].setSize(view.appView.width,'22');
And to remove the tabs, you'll need something like:
------------------------------------------------------------------------------------
public function setNavigation() : Void {
var tab0 = view.appView["tabBar"].getChildAt(0);
var tab1 = view.appView["tabBar"].getChildAt(1);
tab0.visible = false;
tab0.width = 0;
tab1.visible = false;
tab1.width = 0;
view.appView['tabBar'].setSize(view.appView.width,'22');
}
On click, you can get the
selectedIndexof the tab that was clicked, and pass it over to the setNavigator function as a parameter and set the visiblity to false and size to 0.
Dave
On 6/8/05, Eric Raymond <[EMAIL PROTECTED]> wrote:
Each tab correponds to a view (in a viewstack).
--- In [email protected], dave buhler <[EMAIL PROTECTED]> wrote:
> Hi Eric,
>
> Are the tabs specific to an underlying view or are the tabs meant to be
> closeButtons, similar to what you might find for a TitleWindow?
>
> Dave
>
> On 6/7/05, Eric Raymond <[EMAIL PROTECTED]> wrote:
> >
> > Is there a way to add a close button to a tab in a tabbar?
> >
> > That is, we'd like to put a graphic image of an "x" in some tabs in
> > our application that are "closeable".
> >
> > I think there are two issues here:
> >
> > 1) Adding an extra icon to the tab
> >
> > As a hack, we could get away with "prepending" the close image the
> > existing tab icon.
> >
> >
> > 2) Detecting a click in the close icon
> >
> > As far as I know, the tabbar grabs all mouse/click events.
> >
> >
> > Any ideas?
> >
> >
> >
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
------------------------ Yahoo! Groups Sponsor --------------------~-->
<!-- SpaceID=1705007207 loc=TM noad -->
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
Yahoo! Groups Links
- To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

