If you are just using a Tab button,

opps, I meant Tab Bar. Both ways are correct in component development sense.
But you would choose either or based on the factors of... am I going to be
using a tab navigator?

anyway, both will work with some fine tunning.

On 12/20/06, Michael Schmalle <[EMAIL PROTECTED]> wrote:

Hi,

All you need to do is this;

1. Subclass TabNavigator;
2. create

 -> protected var  addButton:Button

3. In createChildren() ovveride;

addButton = new Button();
addButton.styleName = this;
addButton.label = "Add";
addButton.addEventListener(MouseEvent.CLICK, addButton_clickHandler);

rawChildren.addChild(addButton);

4. In the updateDisplayList() override

position the addButtonl; something like..

addButton.move(unscaledWidth - rightPadding -
addButton.getMeasuredOrExplicitWidth(), paddingTop);
addButton.setActualSize(addButton.getMeasuredOrExplicitWidth
                                     addButton.getMeasuredOrExplicitHeight());

Your needs may vary.


5. create the handler

private function addButton_clickHandler(event:MouseEvent):void
{
   dispatchEvent(new Event("addButtonClick"));
}

Vola, you now have a button that you could even skin and...

It gives you a custom event to listen for outside of the TabNavigator.

If you are just using a Tab button, it is the smae procedure although
there might be depth issues that you will have to address.

Peace, Mike


On 12/20/06, Lachlan Cotter <[EMAIL PROTECTED]> wrote:
>
>   Hi Dan,
>
> I can think of two possible approaches.
>
> You could create a proxy data-provider that places a layer between the
> control and the real data provider, that manipulates the data for this view
> (by adding your pseudo item).
>
> or…
>
> You could create a subclass of the control that adds the functionality
> you are describing. I think this would be preferable, since, as you said,
> this is an aspect of the view, not the data.
>
> I'll be interested to see what other ideas there are about this one too.
>
> Cheers,
> Lach
>
>
>
> On 20/12/2006, at 8:42 PM, Dan wrote:
>
> Hi,
>
> I want to implement a tabBar that with the last tab labeled "new" so
> that when ever the user click that "new" tab, a new tab is added to the
> dataprovider. However, I don't want to add a "new" object in that
> dataprovider for that labeled "new" tab at the tail, since it will
> complicated that other operation working on that dataprovider (since
> that "new" tab is actually not one of the data) Is there any way to
> achieve it? Can i manually add a new tab to the tab bar without
> changing the dataprovider?
>
> Thx in advance for any advice.
>
> Dan
>
>
> >



--
Teoti Graphix
http://www.teotigraphix.com

Blog - Flex2Components
http://www.flex2components.com

You can find more by solving the problem then by 'asking the question'.




--
Teoti Graphix
http://www.teotigraphix.com

Blog - Flex2Components
http://www.flex2components.com

You can find more by solving the problem then by 'asking the question'.

Reply via email to