The code I am using is the example from the Flexlib download. I will
post it here as well:

==========================================================================
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:flexlib="http://code.google.com/p/flexlib/"; 
        xmlns:mx="http://www.adobe.com/2006/mxml"; 
        defaultButton="{addButton}" creationComplete="initTabs()">
        <mx:Script>
                <![CDATA[
                        import flexlib.controls.SuperTabBar;
                        import flexlib.events.TabReorderEvent;
                        import flexlib.controls.tabBarClasses.SuperTab;
                        import mx.controls.Label;
                        import mx.containers.VBox;
                        import mx.containers.Canvas;                    
                        import mx.containers.Panel;
                        
                        [Embed(source="assets/document.png")]
                        private var document_icon:Class;
                        
                        [Embed(source="assets/home.png")]
                        private var home_icon:Class;
                        
                        private function initTabs():void
                        {
                                addTab("Home", nav, "This tab can't be closed", 
home_icon);
                                for(var i:int=0; i<3; i++)
                                {
                                        addTab("Tab " + (i + 1), nav);
                                }
                                for(i=3; i<6; i++)
                                {
                                        addTab("Tab " + (i + 1), nav2);
                                }
                                callLater(initNonClosableTab);
                        }
                        
                        private function initNonClosableTab():void
                        {
                                nav.setClosePolicyForTab(0, 
SuperTab.CLOSE_NEVER);
                        }
                        
                        private function addTab(lbl:String, 
navigator:SuperTabNavigator,
contentString:String=null, icon:Class=null):void
                        {
                                if(lbl=="") lbl = "(Untitled)";
                                var curNum:Number = nav.numChildren + 1;
                                var child:VBox = new VBox();
                                child.setStyle("closable", true);
                                child.label = lbl;
                                if(icon)
                                {
                                        child.icon = icon;
                                }
                                else
                                {
                                        child.icon = document_icon;
                                }
                                var label:Label = new Label();
                                label.text = contentString == null ? "Content 
for: " + lbl :
contentString;
                                child.addChild(label);
                                navigator.addChild(child);
                        }
                        
                        /* The following two functions are a bit of a hack to 
try to get the
                         * tab navigator to refresh the display and resize all 
the tabs. When
                         * you change stuff like tabWidth (which is a style) 
then the tab
                         * navigator has a hard time re-laying out the tabs. 
Adding and
                         * removing a child can sometimes trigger it to 
re-layout the tabs.
                         * I don't know, but just don't change tabWdith or 
horizontalGap or
whatever
                         * else at runtime, OK? Pick some values and stick with 
them.
                         */
                        private function invalidateLater():void
                        {
                                var child:Canvas = new Canvas();
                                nav.addChild(child);
                                nav.removeChild(child);
                                callLater(invalidateNav);
                                nav2.addChild(child);
                                nav2.removeChild(child);
                                callLater(invalidateNav);
                        }
                        
                        private function invalidateNav():void
                        {
                                nav.invalidateDisplayList();
                                nav2.invalidateDisplayList();
                        }
                        
                        private function 
tabsReordered(event:TabReorderEvent):void
                        {
                                var tabBar:SuperTabBar = event.currentTarget as 
SuperTabBar;
                                
tabBar.setChildIndex(tabBar.getChildAt(event.oldIndex),
event.newIndex);
                        }
                ]]>
        </mx:Script>
        <mx:VBox width="100%" height="100%" horizontalAlign="center" >
                <mx:HBox>                       
                        <mx:Panel title="Tab Control">
                                <mx:HBox>
                                        <mx:TextInput width="100" id="tabLabel" 
/>
                                        <mx:Button id="addButton"
                                                label="Add Tab" 
                                                click="addTab(tabLabel.text, 
nav); nav.selectedIndex =
nav.numChildren - 1"  />
                                </mx:HBox>
                                <mx:Button label="Remove All" 
click="nav.removeAllChildren()" />
                        </mx:Panel>
                        <mx:Panel title="Options">
                                <mx:HBox>
                                        <mx:CheckBox id="tabWidthCheck" 
                                                label="Speciy tabWidth:" 
                                                
change="if(tabWidthCheck.selected) { nav.setStyle('tabWidth',
tabWidthInput.value); nav2.setStyle('tabWidth', tabWidthInput.value) }
else { nav.setStyle('tabWidth', undefined); nav2.setStyle('tabWidth',
undefined); } invalidateLater();" />
                                        <mx:NumericStepper id="tabWidthInput" 
                                                
enabled="{tabWidthCheck.selected}" 
                                                value="80" minimum="30" 
maximum="400" stepSize="10" 
                                                
change="nav.setStyle('tabWidth', tabWidthInput.value);
nav2.setStyle('tabWidth', tabWidthInput.value); invalidateLater();" />
                                </mx:HBox>
                                <mx:HBox>
                                        <mx:Label text="Horizontal Gap:" />
                                        <mx:NumericStepper id="hGap"
                                                value="0" minimum="0" 
maximum="30" stepSize="1"  
                                                
change="nav.setStyle('horizontalGap', hGap.value);
nav2.setStyle('horizontalGap', hGap.value); invalidateLater(); " />
                                </mx:HBox>
                                <mx:HBox>
                                        <mx:Label text="Minimum tab width:" />
                                        <mx:NumericStepper id="minTab"
                                                value="60" minimum="0" 
maximum="400" stepSize="10"  
                                                change="nav.minTabWidth = 
minTab.value; " />
                                </mx:HBox>
                        </mx:Panel>
                </mx:HBox>
                <mx:Spacer height="20" />
                <!-- These guys are SO super -->
                <flexlib:SuperTabNavigator id="nav" scrollSpeed="25"
dropShadowEnabled="true"
                        stopScrollingEvent="{MouseEvent.MOUSE_UP}"
startScrollingEvent="{MouseEvent.MOUSE_DOWN}"
                        width="90%" height="90%" horizontalGap="0"
                        closePolicy="{SuperTab.CLOSE_ROLLOVER}"/>
                        
                <!-- I was going to call it SuperDuperTabNavigator, but I 
thought
that might be just a tad too much -->
                <flexlib:SuperTabNavigator id="nav2" scrollSpeed="25"
dropShadowEnabled="true"
                        stopScrollingEvent="{MouseEvent.MOUSE_OUT}"
startScrollingEvent="{MouseEvent.MOUSE_OVER}"
                        width="90%" height="90%" horizontalGap="0"
                        closePolicy="{SuperTab.CLOSE_ALWAYS}"/>
        </mx:VBox>
</mx:Application>
===============================================================================

The errors occur on line 23, 26 and 30. These are the lines with the
addTab function calls inside the initTabs function.

Thanks for any help you can provide.


--- In flexcoders@yahoogroups.com, Sherif Abdou <[EMAIL PROTECTED]> wrote:
>
> how are you working this out? some code would help?
> 
> 
> 
> ----- Original Message ----
> From: valdhor <[EMAIL PROTECTED]>
> To: flexcoders@yahoogroups.com
> Sent: Friday, February 29, 2008 12:04:13 PM
> Subject: [flexcoders] Flexlib SuperTabNavigator Errors
> 
> Hi
> 
> I'm a bit of a flex noob and am trying to run the SuperTabNavigator
> example from the Flexlib library in FB3 (I just downloaded the latest
> version of Flexlib - V2.3.2). Unfortunately, I keep getting the error
> "Implicit coercion of a value of type
> flexlib.containers: SuperTabNavigato r to an unrelated type
> SuperTabNavigator. "
> 
> Anyone have any ideas on how to fix this?
> 
> 
>  
> 
> 
>      
____________________________________________________________________________________
> Never miss a thing.  Make Yahoo your home page. 
> http://www.yahoo.com/r/hs
>


Reply via email to