Tabbar spark, states

In a component that has multiple states, I use a spark TabBar based on a ViewStack
containing a list of Navigator Content. The number of tabs changes when the component states
changes.
The TabBar works, but sometimes there are some bugs: after a state change, it can
have multiple tabs selected.
Bug1:
Select in state three (using the comboBox)
then I select the last tab
then I select the state two (using the comboBox).
Result: the onglet3 and 4 are selected.
Bug2:
  I want to force the selection of the first tab after a change
state (idViewStack.selectedIndex = 0;)
Result: multiple tabs are selected.
code:
<?xml version="1.0" encoding="utf-8"?>
<s:VGroup xmlns:fx="http://ns.adobe.com/mxml/2009"
              xmlns:s="library://ns.adobe.com/flex/spark"
              xmlns:ns="library://ns.adobe.com/flex/mx"
              xmlns:tabbarNavigation="tabbarNavigation.*"
              xmlns:views="views.*"
              width="1000" height="800"
              creationComplete="application1_creationCompleteHandler(event)" xmlns:tabbarNavigation2="tabbarNavigation2.*" xmlns:tabBarNavigation="tabBarNavigation.*">
      <fx:Script>
            <![CDATA[
                  import mx.collections.ArrayCollection;
                  import mx.controls.Alert;
                  import mx.events.FlexEvent;
                  import spark.events.IndexChangeEvent;
                  [Bindable()]
                  public var dataproviderStatesChoise:ArrayCollection = new ArrayCollection();
                  protected function application1_creationCompleteHandler(event:FlexEvent):void
                        dataproviderStatesChoise.addItem("state1");
                        dataproviderStatesChoise.addItem("state2");
                        dataproviderStatesChoise.addItem("state3");
                        statesChoise.selectedIndex=0;
                  protected function changeHandler(event:IndexChangeEvent):void
                        if(event.newIndex==0){
                             currentState="state1";
                        }else if(event.newIndex==1){
                             currentState="state2";
                        }else {
                             currentState="state3";
            ]]>
      </fx:Script>
      <s:states>
            <s:State name="state1"/>
            <s:State name="state2"/>
            <s:State name="state3"/>
      </s:states>
      <s:ComboBox id="statesChoise" dataProvider="{dataproviderStatesChoise}" change="changeHandler(event)"/>
      <s:TabBar dataProvider="{idViewStack}" id="idTabBar"  />
      <ns:ViewStack id="idViewStack" width="95%" height="85%" left="8" y="23" >
            <s:NavigatorContent label="Tab1"  width="100%" height="100%" includeIn="state3">
                  <s:Label text="Tab1" />
            </s:NavigatorContent>
            <s:NavigatorContent label="Tab2"  width="100%" height="100%" includeIn="state2,state3">
                  <s:Label text="Tab2" />
            </s:NavigatorContent>
            <s:NavigatorContent label="Tab3"  width="100%" height="100%" >
                  <s:Label text="Tab3" />
            </s:NavigatorContent>
            <s:NavigatorContent label="tab4 "  width="100%" height="100%">
                  <s:Label text="Tab4" />
            </s:NavigatorContent>
      </ns:ViewStack>
</s:VGroup>

It looks like bug1 and bug2 is the same issue.  Here is a reduced test case that demonstrates the bug:
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
          xmlns:s="library://ns.adobe.com/flex/spark"
          xmlns:mx="library://ns.adobe.com/flex/mx">
    <s:states>
        <s:State name="state1"/>
        <s:State name="state2"/>
        <s:State name="state3"/>
    </s:states>
    <s:controlBarContent>
        <s:Button label="1. go to state2" click="currentState='state2'" />
        <s:Button label="2. go to state3" click="currentState='state3'" />
    </s:controlBarContent>
    <s:TabBar dataProvider="{vs}" />
    <mx:ViewStack id="vs" y="25">
        <s:NavigatorContent label="Tab1" includeIn="state3">
            <s:Label text="Tab1" />
        </s:NavigatorContent>
        <s:NavigatorContent label="Tab2" includeIn="state2,state3">
            <s:Label text="Tab2" />
        </s:NavigatorContent>
        <s:NavigatorContent label="Tab3">
            <s:Label text="Tab3" />
        </s:NavigatorContent>
    </mx:ViewStack>
</s:Application>
Steps to reproduce:
1. Compile and run above MXML
2. Click "1. go to state2"
3. Click "2. go to state3"
4. Notice two tabs show as selected
Can you please file a bug at http://bugs.adobe.com/flex and post the link here?  Let me know if you would rather that I file it.

Similar Messages

  • Set Spark TabBar ItemRenderer State

    I have a custom ItemRenderer for a tabBar and I need to be able to control the state of each itemRenderer on the tabBar individually. For example, if a change is made to the data in one of the tabs, I want to change the display of the tab to the "unsaved" state, so that a user has a visual cue when there are usaved edits.
    <?xml version="1.0" encoding="utf-8"?><s:ItemRenderer  xmlns:fx="http://ns.adobe.com/mxml/2009"xmlns:s="
    library://ns.adobe.com/flex/spark"xmlns:mx="
    library://ns.adobe.com/flex/mx"top="
    2" width="200" height="34" autoDrawBackground="false" buttonMode="true">
     <s:states>  
    <s:State name="normal"/>  
    <s:State name="selected"/>  
    <s:State name="hovered"/>  
    <s:State name="unsaved"/>
     </s:states> 
    <!-- background --> 
    <s:Rect left="1" right="1" top="1" bottom="0" radiusX="5" radiusY="5">  
    <s:fill>  
    <s:LinearGradient rotation="90">  
    <s:GradientEntry color="0xffffff"/>  
    <s:GradientEntry color="0xd8d8d8" alpha="0.85" color.selected="0xf76a6a" alpha.selected="1.0" color.hovered="0x929496" alpha.hovered="0.85"/>  
    </s:LinearGradient>  
    </s:fill>  
    </s:Rect> 
    <!-- border rectangle --> 
    <s:Line left="0" right="0" top="1">  
    <s:stroke>  
    <s:SolidColorStroke weight="1" alpha="1.0" color="0x999999"/>  
    </s:stroke>  
    </s:Line> 
    <s:Line left="0" bottom="0" top="1">  
    <s:stroke>  
    <s:SolidColorStroke weight="1" alpha="1.0" color="0x999999"/>  
    </s:stroke>  
    </s:Line> 
    <s:Line right="0" bottom="0" top="1">  
    <s:stroke>  
    <s:SolidColorStroke weight="1" alpha="1.0" color="0x999999"/>  
    </s:stroke>  
    </s:Line> 
    <s:Line left="0" right="0" bottom="0">  
    <s:stroke>  
    <s:SolidColorStroke weight="1" alpha="1.0" color="0x999999" alpha.selected="0.0" color.selected="0xffffff"/>  
    </s:stroke>  
    </s:Line> 
    <s:Label left="4" right="20" fontSize="14" text="{data.LastName}, {data.FirstName}"verticalCenter="
    0"/>
     <s:Label id="closePtX" right="5" top="5" fontSize="14" fontWeight="bold" text="x"/></s:ItemRenderer>

    hi,
    With state transitions a lot of the smarts are already built in, when fading for instance the transition knows when to fade in or fade out, getting your components placed in the states you want is all that is needed.
    This is a simple example but as you can see there is virtually no code involved..
    http://gumbo.flashhub.net/cyber/  source included
    David.

  • Load speed: FLEX MX:TABNAVIGATOR LOAD SPEED VERSUS SPARK:TABBAR

    TODAY I NOTICED A LARGE DIFFERENCE BETWEEN
    THE OLDER MX:TABNAVIGATOR
    AND NEWER S:TABBAR (SPARK)
    Summary:
    My test application was built in flex builder 4 and I was using my localhost (asp.net devlepment enviroment) for testing.
    Tests I built:
    I built many proofs for concept using flex objects, ui  and data handlers.
    HOW WAS THIS TEST (which I spoke about in the title) CREATED:
    I built two components which will be used as CHILDREN to the main application.  The fist child component used the SPARK TABBAR and the other child component used the MX:TABNAVIGATOR.  The main application declared these children (using action script) initially and a List control actually loaded the children into the main application.
    BOTH CHILD COMPPONENTS had 10 tabs....
    5 of the 10 tabs contained "grand" child components (none of the components(main application/children/grandchildren) worked with external data)
    RESULTS:
    THE LOAD SPEED BETWEEN THE TWO CONTROLS was very noticable between the two controls.
    THE SPARK COMPONENT (S:tabbar) AVERAGED 3-5 SECONDS TO LOAD
    WHERE THE MX:TABNAVIGATOR ONLY TOOK 1-2 SECONDS
    HAS ANYBODY ELSE EXPERIENCED THE SAME RESULTS?
    THANKS,
    DOUG LUBY OF LOUISIANA
    WWW.douglubey.com
    SEARCH:  FLEX MX:TABNAVIGATOR LOAD SPEED VERSUS SPARK:TABBAR

    It definately seems to fit (pretty good).
    My labels in the "TABS" were of different length.
    So I converted them all to be the same length.
    <s:TabBar dataProvider="{viewstackSampleB}" id="sampleBMainTabBar"left="
    11" top="8" right="11" height="34" fontSize="6"/>
    <mx:ViewStack id="viewstackSampleB" cornerRadius="20" top="40" bottom="10" left="10" right="10">
    <s:NavigatorContent label="Profile___________________" width="100%" height="100%">
    <s:NavigatorContent left="0" top="0" right="0" bottom="0" backgroundColor="#000080">
    <sample:SampleB_Profile id="studentProfile" left="2" top="2" right="2" bottom="2"/>
    </s:NavigatorContent>
    </s:NavigatorContent>
    <s:NavigatorContent label="SampleB_DragNDrop1________" width="100%" height="100%">
    <s:NavigatorContent left="0" top="0" right="0" bottom="0" backgroundColor="#000080">
    <sample:SampleB_DragNDrop1 id="studentDragNDrop1" left="2" top="2" right="2" bottom="2"/>
    </s:NavigatorContent>  
    </s:NavigatorContent>
    <s:NavigatorContent label="SampleB_DragNDrop2________" width="100%" height="100%">
    <s:NavigatorContent left="0" top="-3" right="0" bottom="0" backgroundColor="#AEAEAE">
    <sample:SampleB_DragNDrop2 id="studentDragNDrop2" left="2" top="2" right="2" bottom="2"/>
    </s:NavigatorContent>  
    </s:NavigatorContent>  
    <s:NavigatorContent label="SampleB_PullDataFromParent" width="100%" height="100%">
    <s:NavigatorContent left="0" top="-3" right="0" bottom="0" backgroundColor="#AEAEAE">
    <sample:SampleB_PullingDataParent id="studentPullingDataParent" left="2" top="2" right="2" bottom="2"/>
    </s:NavigatorContent>  
    </s:NavigatorContent>  
    <s:NavigatorContent label="Tab Five__________________" width="100%" height="100%">
    <s:NavigatorContent left="0" top="-3" right="0" bottom="0" backgroundColor="#AEAEAE">
    </s:NavigatorContent>  
    </s:NavigatorContent>  
    <s:NavigatorContent label="Tab Six___________________" width="100%" height="100%">
    <s:NavigatorContent left="0" top="-3" right="0" bottom="0" backgroundColor="#AEAEAE">
    </s:NavigatorContent>  
    </s:NavigatorContent>  
    <s:NavigatorContent label="Tab Seven_________________" width="100%" height="100%">
    <s:NavigatorContent left="0" top="-3" right="0" bottom="0" backgroundColor="#AEAEAE">
    </s:NavigatorContent>  
    </s:NavigatorContent>
    <s:NavigatorContent label="Tab Eight_________________" width="100%" height="100%">
    <s:NavigatorContent left="0" top="-3" right="0" bottom="0" backgroundColor="#AEAEAE">
    </s:NavigatorContent>  
    </s:NavigatorContent>
    <s:NavigatorContent label="Tab Nine__________________" width="100%" height="100%">
    <s:NavigatorContent left="0" top="-3" right="0" bottom="0" backgroundColor="#AEAEAE">
    </s:NavigatorContent>  
    </s:NavigatorContent>
    <s:NavigatorContent label="Tab Ten___________________" width="100%" height="100%">
    <s:NavigatorContent left="0" top="-3" right="0" bottom="0" backgroundColor="#AEAEAE">
    </s:NavigatorContent>  
    </s:NavigatorContent>  
    </mx:ViewStack>
    THIS APPEARS TO HAVE THE SAME LOAD TIME as the TabNavigator.
    So I have to ask:
    What is a permanent fix for this.
    Where I can I update my current "Build" for FLEX 4
    so my application does not retain this bug.
    OR ANOTHER QUESTION...what can I exclude in my declarations to fix this bug.
    I would prefer to use the Spark TabBar over the mx:tabnavigator
    MY CURRENT "BUILD" is 4.0.1.277662

  • Best Practice with Spark, display an animated loading screen

    In the past I would use Flash to create assests and then write the actionscript to interact with those assets.  So if I wanted to show an animated loading screen, I would create it in flash with the animation tools, set up it up to be a class of "LoadingScreen", then whenever I wanted to show a loading screen I would just create a new instance of LoadingScreen and add it to the stage.  When I eventually get a responce from my server I would remove the LoadingScreen.
    I want to do this in Flash Builder using the latest tools (states, spark, skinning, etc).  How would you do this?
    I imagine I won't have to create a seperate state for my various pages plus an extra state for each page showing the loading screen, correct? (page1, page1Loading, page2, page2Loading, etc)
    I have created the animated loading screen in Flash and exported the file out as a swc, so I have access to it in Builder, but what do I do from there, I can't do an addChild.
    Any ideas?  I am still trying to get my head around how to work with all of these new tools.

    I'm not really sure what you were doing before, but you can use the Flash Component Kit to export your Flash content and bring it in to Flex.  Flash Builder exposes this more readily today as you can create a Flash component, and it'll open up Flash Authoring and automatically use the Flash Component Kit for Flex behind the scenes.  If you dont' care much about getting the sizing of your Flash content correct in Flex, you could just addChild() your Flash content to a UIComponent, which is what I assume you were doing before.
    In terms of Spark states and skins, I'm not really sure what your question is.  You can drop your Flash component in to a skin if you want and use states to control when it is visible just like another other component in Spark.

  • Place spark TabBar on Bottom of ViewStacks (+ rounded corners pointing downwards)

    Why is it so hard to do such a simple thing... I figure also it must be a very common thing.
    <s:VGroup horizontalAlign="center" horizontalCenter="0" verticalCenter="0" gap="0">
        <mx:ViewStack id="view" width="450" height="300" />
        <!-- NavigatorContent dynamically gets added to view on appComplete-->
        <s:TabBar dataProvider="{view}" skinClass="skins.CustomSparkTabBarSkin" />
    </s:VGroup>
    The Custom Skin:
    <s:Skin
    xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:fb="http://ns.adobe.com/flashbuilder/2009"    
    alpha.disabled="0.5"><fx:Metadata>
        <![CDATA[
        [HostComponent("spark.components.TabBar")]
        ]]>
    </fx:Metadata>
    <fx:Script  fb:purpose="styling" >
        <![CDATA[
        import mx.core.UIComponent;
        /**  Push the cornerRadius style to the item renderers.*/
        override protected function updateDisplayList(unscaledWidth:Number, unscaleHeight:Number):void {
            const numElements:int = dataGroup.numElements;
            const cornerRadius:int = hostComponent.getStyle("cornerRadius");
            for (var i:int = 0; i < numElements; i++) {
                var elt:UIComponent = dataGroup.getElementAt(i) as UIComponent;
                if (elt)
                    elt.setStyle("cornerRadius", cornerRadius);
            super.updateDisplayList(unscaledWidth, unscaledHeight);
        ]]>           
    </fx:Script>
    <s:states>
        <s:State name="normal" />
        <s:State name="disabled" />
    </s:states>
    <!--- @copy spark.components.SkinnableDataContainer#dataGroup -->
    <s:DataGroup id="dataGroup" width="100%" height="100%">
    Comes out with this component:
    I would like to place that TabBar at the Bottom of the viewstack, rounded corners pointing outwardly.
    if I add rotation="180" to the TabBar <s:TabBar dataProvider="{view}" skinClass="skins.CustomSparkTabBarSkin" rotation="180"/> will make the matter all the more laughable. I don't understand why is it so hard to create a TabNavigator with the buttons on the bottom?!

    Alright, I solved it by using Flash Catalyst... at least its' a simple way...
    So what I did was, Skinned it in Photoshop, imported it to Catalyst, and did the ncessary (convert to button, and select the label for it) and imported it into Flash Builder 4.
    I added the following component in Main:
    <mx:ViewStack id="view" width="450" height="300"  x="33" y="70"/>
    <s:TabBar id="tabBar" dataProvider="{view}" skinClass="components.CustomSparkTabBarSkin" y="375" x="32"/>
    The component.CustomSparkTabBarSkin
    <s:DataGroup id="dataGroup" width="100%" height="100%">
        <s:layout>
            <s:ButtonBarHorizontalLayout gap="4"/>
        </s:layout>
        <s:itemRenderer>
           <fx:Component>
               <s:ButtonBarButton skinClass="components.TabButton" buttonMode="true"/>
           </fx:Component>
        </s:itemRenderer>
    The components.TabButton (generated by Flash Catalyst)
    <s:Group d:userLabel="Tab Button 1" x="0" y="0">
         <s:BitmapImage smooth="true" source="@Embed('/assets/images/Game Tab Navigator/Buttonec.png')" d:userLabel="Button 99c" x="4" y="0"/>
         <s:RichText alpha="0.95" color="#725b3c" fontFamily="Bebas" fontSize="18" height="20" lineHeight="120%" textAlign="center" d:userLabel="hello" whiteSpaceCollapse="preserve" width="62" x="0" y="24" x.up="0" y.up="14">
              <s:content>
                   <s:p>
                   <s:span>Hello</s:span>
                   <s:span baselineShift="2" fontFamily="Myriad Pro" fontSize="17" fontWeight="bold">¢</s:span>
                   </s:p>
            </s:content>
         </s:RichText>
    </s:Group>
    Now the problem is... When I label my NavigatorContent, and dynamically added to the ViewStack (which is the dataprovider of the TabBar), the TabBar don't show the labels...
    Even though it's hardcoded in the example above to show Hello ... Nothing shows.
    What am I missing?

  • Spark datagrid not behaving properly (maybe states bug)

    I am using this as the renderer in my Spark datagrid, however the modified state is getting set when I hover over the row. I've set breakpoints in the set data funtion to see if this is being called, but it is not,
    the code  currentState = "modified"; is being called out side of the set data function but I have not written that code anywhere !!!
    <?xml version="1.0" encoding="utf-8"?>
    <s:GridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
                    xmlns:s="library://ns.adobe.com/flex/spark"
                    xmlns:mx="library://ns.adobe.com/flex/mx"
                     currentState="unmodified">
        <fx:Script>
            <![CDATA[
                override public function set data(value:Object):void
                    super.data = value;
                    if(data){
                        if(this.data.isModifiedClientSide){
                            currentState = "modified";
                        else{
                            currentState = "unmodified";
            ]]>
        </fx:Script>
        <s:states>
            <s:State name="modified"/>
            <s:State name="unmodified"/> 
        </s:states> 
        <s:Rect top="0" left="0" right="0" bottom="0"> 
            <s:fill><s:SolidColor color.modified="0xddddff" color="0xFFffff"  /></s:fill> 
        </s:Rect> 
        <s:Rect left="1" top="1" right="0" bottom="0" includeIn="modified">
            <s:stroke >
            <s:SolidColorStroke color="0x000099" weight="1">
            </s:SolidColorStroke>
            </s:stroke>
        </s:Rect>
        <s:VGroup horizontalAlign="center" verticalAlign="middle" top="0" left="0" right="0" bottom="0">
            <s:Label text="{data.margin}">
            </s:Label>
        </s:VGroup>
    </s:GridItemRenderer>

    Thanks for the reply CodeMata!
    I'm trying to manage the view transitions (whether it slides left or right) based on the current view and which button is pressed.  The below code snippet is the handler for a button who's id is "transactionsButton", and corresponds to the transaction view.  There are three buttons total, the layout is as follows:
    | processTransactionButton | transactionsButton | settingsButton |
    When the user is in the ProcessTransaction view and clicks on the transactionsButton I want it to slide left, but if they are at the Settings view I want it to slide right.
    Here is the handler for the transactionsButton (the commented out line is where I'm having trouble!!!):
    protected function transactionsButtonHandler():void
         if (!(navigator.activeView is views.Transactions))
              if (navigator.activeView is views.ProcessTransaction) {navigator.pushView(views.Transactions);}
              else if (navigator.activeView is views.Settings)
                   navigator.popView();
                   //navigator.pushView(views.Transactions, null, SlideViewTransition("right"));
                   navigator.pushView(views.Transactions);

  • Why can't i create states in spark.group?

    Hi All,
    How can i use the spark stated in group?
    I'm trying to do:
    <?xml version="1.0" encoding="utf-8"?><s:Group ...
         <s:States>
             <s:state> ....
    Can can't get this option.   Is it possible that the state can be used only under s:application ?

    There's some typos in your example, try:
    <s:states>
         <s:State> ...
    Jason San Jose
    Quality Engineer, Flash Builder

  • Spark TabBar: How to disable single tabs?

    Hi,
    I wrote already a bug report about this issue, but no one responded.
    For an application I need to disable and enable tabs on the fly. So I built a TabBar with a ViewStack as a dataProvider and NavigatorContent as the single items. Then I tried disabling a NavigatorContent component so that the tab is disabled. But it is still enabled and can be selected. How can I disable a single tab? Do I have to create a custom solution or wait until the TabNavigator component is ported to Spark? (Maybe I should fall back to the halo component)
    Also the enabled property of the TabBar doesn't disable the tab content. So there seems to be no connection between the data and the TabBar.

    If you find this post looking for the answer, I posted two options here: http://forums.adobe.com/message/4153359#4153359
    =D

  • How to disable a tab in a spark tab bar?

    I have a spark tab bar linked to a ViewStack.  In olden days, IIRC,  setting the enabled property of a viewstack member would set the corresponding tab inactive.  However, if I try that now, the tab control is still active, but the contents of the viewstack for that tab is indeed disabled.
    To reiterate:  I want certain tabs in a spark tab bar to be disabled (i.e. unable to be chosen and displaying their disabled skin state).
    <s:TabBar id="tabBar" dataProvider="{tabStack}" x="70" y="91" skinClass="CalculatorTabsSkin"/>
    <mx:ViewStack id="tabStack" width="100%" height="100%" creationPolicy="all" change="tabStack_changeHandler(event)">
         <s:NavigatorContent id="nc1" label="PIERS">
         <comp:Tab1 id="tab1"  width="100%" height="100%" continue="tab1_continueHandler(event)" />
         </s:NavigatorContent>
         <s:NavigatorContent id="nc2" label="FOOTINGS">
         <comp:Tab2 id="tab2" width="100%" height="100%" continue="tab2_continueHandler(event)" numberOfPiers="{totalNumberPiers}" />
         </s:NavigatorContent>
         <s:NavigatorContent id="nc3" label="BAGS OR TRUCK?">
         <comp:Tab3 id="tab3"  width="100%" height="100%" totalCubicYards="{totalCubicYards}" totalNumberBags="{totalNumberBags}" />
         </s:NavigatorContent>
    </mx:ViewStack>

    Addendum:
    Literally two minutes after I got back to actually working, I found a more "elegant" solution.  I posted it elsewhere, but I guess I forgot to share it here. =/ So I thought I'd update this real quick. =)
    If you apply a custom skinClass to your tab bar you can bind the tab.enabled property just like you'd expect/want.
    <!-- some component that has the TabBar in it... -->
        <fx:Script>
             <![CDATA[
        [Bindable] private var tab2IsReady:Boolean = false;
        private function checkCriteria():void{
             tab2IReady = someOtherThing.isFinished;//Boolean
        ]]>
        </fx:Script>
    <s:TabBar id="theTabBar"
       dataProvider="{viewStack}"
       skinClass="skins.CustomTabBarSkin"/>
    <mx:ViewStack id="viewStack">
          <s:NavigatorContent label="Tab index 0">
               <!-- Your first tab's content -->
          </s:NavigatorContent>
          <s:NavigatorContent label="Tab index 1" enabled="{tab2IsReady}">
               <!-- Your second tab's content -->
          </s:NavigatorContent>
    </mx:ViewStack>
    <!-- rest of the component that has the the TabBar in it... -->
    When you type "skinClass" use the auto complete to generate the custom skin (named whatever you want).
    The generated code will appear like below (I left out the Script tag).
    <?xml version="1.0" encoding="utf-8"?>
    <!-- skins/CustomTabBarSkin.mxml
    Adobe's copyright & doc comments
    -->
    <s:Skin
        xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:fb="http://ns.adobe.com/flashbuilder/2009"    
        alpha.disabled="0.5">
        <fx:Metadata>
            <![CDATA[
             * @copy spark.skins.spark.ApplicationSkin#hostComponent
            [HostComponent("spark.components.TabBar")]
            ]]>
        </fx:Metadata>
          <!-- optional Script tag here -->
        <s:states>
            <s:State name="normal" />
            <s:State name="disabled" />
        </s:states>
        <!--- @copy spark.components.SkinnableDataContainer#dataGroup -->
        <s:DataGroup id="dataGroup" width="100%" height="100%">
            <s:layout>
                <s:ButtonBarHorizontalLayout gap="-1"/>
            </s:layout>
            <s:itemRenderer>
                <fx:Component>
                    <s:ButtonBarButton skinClass="spark.skins.spark.TabBarButtonSkin" />
                </fx:Component>
            </s:itemRenderer>
        </s:DataGroup>
    </s:Skin>
    <!-- End skins/CustomTabBarSkin.mxml -->
    Then add the enabled property to the ButtonBarButton & bind it to data.enabled in your skin class.
    Change:
               <fx:Component>
               <s:ButtonBarButton skinClass="spark.skins.spark.TabBarButtonSkin" />
           </fx:Component>
    To:
               <fx:Component>
               <s:ButtonBarButton skinClass="spark.skins.spark.TabBarButtonSkin"
                    enabled="{data.enabled}" />
         </fx:Component>
    Then any <s:NavigatorContent/> used with a TabBar using that skin will respect the enabled property and do exactly what you expect & want (be enabled when true, & disabled when false).
    Hope this helps some people.  WIsh I'd remembered to re-post it here when I first figured it out.
    Happy Coding! =D
    Todd
    Message was edited by: Chaos7703 - Just made one statement a bit more explicit.

  • [svn:fx-trunk] 5152: First pass of bug fixes for the Spark skins for Halo components.

    Revision: 5152
    Author: [email protected]
    Date: 2009-03-03 13:18:45 -0800 (Tue, 03 Mar 2009)
    Log Message:
    First pass of bug fixes for the Spark skins for Halo components.
    Bugs:
    SDK-19963 - themeColor should not affect rollOverColor or selectionColor in flex 4
    SDK-19654 - Spark skin for the Halo ComboBox dropdown needs a drop shadow
    SDK-19637 - Halo HScrollBar/VScrollBar controls dont render correctly when specifying includeIn states
    SDK-19634 - Halo ProgressBar default size is very different when using Halo vs Gumbo theme
    SDK-19626 - Flicker when toggling enabled property on Halo TabBar control with Gumbo skin
    SDK-19556 - selected Halo CheckBox and RadioButton icons briefly flicker when you roll over them
    SDK-19658 - Halo ComboBox with Gumbo skin has an odd flicker
    Doc/QA Notes: The fix for SDK-19963 includes a compatibility-version check. When compatibility-version < 4, setting themeColor implicitly sets rollOverColor and selectionColor, if they have not been set. When compatibility-version >= 4, you must explicitly set rollOverColor and selectionColor, even when using the Halo theme.
    Ticket Links:
    http://bugs.adobe.com/jira/browse/SDK-19963
    http://bugs.adobe.com/jira/browse/SDK-19654
    http://bugs.adobe.com/jira/browse/SDK-19637
    http://bugs.adobe.com/jira/browse/SDK-19634
    http://bugs.adobe.com/jira/browse/SDK-19626
    http://bugs.adobe.com/jira/browse/SDK-19556
    http://bugs.adobe.com/jira/browse/SDK-19658
    http://bugs.adobe.com/jira/browse/SDK-19963
    Modified Paths:
    flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/FxApplication.as
    flex/sdk/trunk/frameworks/projects/framework/defaults.css
    flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/Button.as
    flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/ComboBase.as
    flex/sdk/trunk/frameworks/projects/framework/src/mx/core/Application.as
    flex/sdk/trunk/frameworks/projects/framework/src/mx/core/UIComponent.as
    flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/RectangularDropShadow.as
    flex/sdk/trunk/frameworks/projects/sparkskins/src/mx/skins/spark/BorderSkin.mxml
    flex/sdk/trunk/frameworks/projects/sparkskins/src/mx/skins/spark/ProgressBarTrackSkin.mxm l

  • [svn:fx-trunk] 9407: Reordering the if-statement in isMeasureFixed() exposed that hostFormat can be null when measure() is called if styles changed and measure is done before the next commitProperties .

    Revision: 9407
    Author:   [email protected]
    Date:     2009-08-19 15:11:34 -0700 (Wed, 19 Aug 2009)
    Log Message:
    Reordering the if-statement in isMeasureFixed() exposed that hostFormat can be null when measure() is called if styles changed and measure is done before the next commitProperties.  This states test exposed this.
    We should rethink if we want to clear hostFormat rather than have a hostFormatChanged flag.  If there is no hostFormat at measure then it has to be fixed because there is no line break format to check for auto-size.
    QE notes:
    Doc notes:
    Bugs: SDK-22779
    Reviewer: Gordon
    Tests run: checkintests
    Is noteworthy for integration: no
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-22779
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/spark/src/spark/primitives/RichEditableText.as

    Oh my god, it is too long! You definitely check out types, casting and especially ODP.Net (it does everything for you)... etc. They can help you to simplify your code. I do not have enough time to copy paste it to Studio and understand and solve your issue, so I got title of your message as your main question.
    In Oracle, you can create an autonumber field by using sequences object. This is really useful when you need to create a unique number to act as a primary key.
    Basically you can create a sequence simply typing;
    CREATE SEQUENCE MY_SEQUENCE;
    now you have a sequence called "MY_SEQUENCE"... Then, I advice you select a number from sequence;
    select MY_SEQUENCE.nextval from dual;
    I said I advice actually kinda must, although it called sequence, I cannot be sequential. Do not even try to predict the value. You can be sure that it is unique number so you can use it.
    Then insert you record and use that number part of your primary key. I think that's it. Have fun.

  • Connection/ResultSets/Prepared Statement opening and closing

    Hi all another question that was sparked by a thread that I recently read. I believe it was duffmo who got the code from jverd. The code I am referring to is to have an open and close connection specified in a Utility or Database class. I wanted to know if there was any issues with having methods that open and close connections/result sets/ preparedStatements. Currently I am putting the finally blocks inside each of my methods. There is obvious benefits to putting the methods in a class on their own (namely code re-use) but I wanted to know if there are any dangers. (This may seem like a dumb question, but I've found from experience it's the things that you don't know that will cost you loads of time).
    thanks again.

    Hi all another question that was sparked by athread
    that I recently read. I believe it was duffmo who
    got the code from jverd. Generally speaking it's fine.
    But as always you may have some long term design
    issues to think about. If you build a simple
    framework that consists of one class and that does
    all that your program does then great.
    Once you start add more complexity though you'll want
    to be careful that you aren't reinventing the Spring
    wheel or even ending up implementing your own
    connection pool. Both of which, judging from posts
    here seem to happen from time to time.
    So I guess all in all, yes it's much better than
    scattering the code all about but depending on what
    you are going to be doing with it you may want to
    look at the various ORM frameworks to see if they are
    really the direction you should be going in.Thanks for the information cotton. I just wanted to make certain that it was a sensible thing to do. When I had first asked about connections I was told they should be opened an closed in the same spot, unfortunately I took that explanation a little too much to heart, and started opening and closing every connection resultset and prepared statement in each of the DAO classes that I was using.
    Guess it's going to be a bit of work to refactor, but worth it for the cleaner code that will result.

  • Relationship between a Spark DropDownList's dataProvider and selectedItem

    I'm working on an existing project and have come across a somewhat complicated issue regarding a Spark DropDownList's (actually, a custom component inheriting from it) displayed item not changing when its dataProvider is updated.
    Here's the code for the custom TitleWindow component containing the custom DropDownList:
    <?xml version="1.0" encoding="utf-8"?>
    <components:RFTitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009"
                              xmlns:s="library://ns.adobe.com/flex/spark"
                              xmlns:mx="library://ns.adobe.com/flex/mx"
                              xmlns:components="components.*"
                              xmlns:rfform="rfform.*"
                              width="550" height="450"
                              title="{currentState} Site Equipment"
                              cancelButton="{btnCancel}"
                              defaultButton="{btnSave}"
                              initialFocus="{rftName}"
                              creationComplete="init()" close="cancelEdit()">
      <fx:Script>
        <![CDATA[
          import events.SiteEquipmentEvent;
          import events.SiteEquipmentTypeEvent;
          import mx.collections.ArrayList;
          import mx.controls.Menu;
          import mx.core.FlexGlobals;
          import mx.core.UIComponent;
          import mx.events.MenuEvent;
          import mx.managers.PopUpManager;
          import mx.validators.ValidationResult;
          import mx.validators.Validator;
          import spark.events.IndexChangeEvent;
          private const TYPES:Array = ["A", "B", "C", "D"];
          [Bindable] [Embed(source="../assets/images/circle_red_x.gif")] private var icoRedX:Class;
          [Bindable] private var siteEquipment:SiteEquipment;
          private var validators:Array;
          private var typePopUp:Menu;
          public static function open(item:SiteEquipment):SiteEquipmentEdit
            var s:SiteEquipmentEdit = new SiteEquipmentEdit();
            s.siteEquipment = item;
            PopUpManager.addPopUp(s, DisplayObject(FlexGlobals.topLevelApplication), true);
            PopUpManager.centerPopUp(s);
            return s;
          private function init():void
            initTypePopUp();
            if (siteEquipment.id == SiteEquipment.NEW_ID)
              currentState = "New";
            else
              currentState = "Edit";
              validateAll();
              if (!rftName.enabled)
                rfcmbType.setFocus();
            siteEquipment.addEventListener(SiteEquipmentEvent.SITE_EQUIPMENT_SAVE, saveComplete);
          override public function dispose(event:Event = null):void
            super.dispose();
            siteEquipment.removeEventListener(SiteEquipmentEvent.SITE_EQUIPMENT_SAVE, saveComplete);
            typePopUp.removeEventListener("itemClick", typePopUp_click);
            siteEquipment.dispose();
            icoRedX = null;
            siteEquipment = null;
            validators = null;
            typePopUp = null;
            removeChildren();
          private function cancelEdit():void
            siteEquipment.cancelEdit();
          private function saveForm():void
            var newValue:SiteEquipment = new SiteEquipment();
            newValue.id = siteEquipment.id;
            newValue.locid = siteEquipment.locid;
            newValue.name = rftName.trimmedText;
            siteEquipment.save(newValue);
          private function saveComplete(event:Event):void
            dispose();
          private function typePopUp_click(event:MenuEvent):void
            switch(event.item)
              case "Edit Selected Type":
                SiteEquipmentType(rfcmbType.selectedItem).showEditForm();
                break;
              case "Create A New Type":
                new SiteEquipmentType().showEditForm(type_created, null, type_removeListeners);
                break;
          private function type_created(event:SiteEquipmentTypeEvent = null):void
            type_removeListeners(event);
            rfcmbType.selectedItem = event.siteEquipmentType;
          private function type_removeListeners(event:Event):void
            var s:SiteEquipmentType = SiteEquipmentType(event.target);
            s.removeEventListener(SiteEquipmentTypeEvent.SITE_EQUIPMENT_TYPE_CREATE, type_created);
            s.removeEventListener(SiteEquipmentType.SITE_EQUIPMENT_TYPE_CANCEL, type_removeListeners);
          private function initTypePopUp():void
            typePopUp = Menu.createMenu(puType, ['Edit Selected Type', 'Create A New Type']);
            typePopUp.addEventListener("itemClick", typePopUp_click);
          private function popupTypeOptions():void
            var p:Point = puType.localToGlobal(new Point(0, puType.height + 5));
            typePopUp.show(p.x, p.y);
          private function validateAll():void
            var isValid:Boolean;
            for each (var validator:Validator in validators)
              isValid = true;
              for each (var result:ValidationResult in validator.validate().results)
                if (result.isError)
                  isValid = false;
                  break;
              UIComponent(validator.source).styleName = "valid_" + isValid.toString();
          private function rfcmbType_changeHandler(event:IndexChangeEvent):void
            if (TYPES.indexOf(SiteEquipmentType(RFDropDownList(event.target).selectedItem).name) > -1)
              rftName.text = "Blah";
              rftName.enabled = false;
            else
              rftName.enabled = true;
        ]]>
      </fx:Script>
      <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
        <s:DateTimeFormatter id="mdy"
                             dateTimePattern="MM/dd/yyyy"/>
      </fx:Declarations>
      <components:states>
        <s:State name="Edit"/>
        <s:State name="New"/>
      </components:states>
      <rfform:RFForm width="100%" height="100%"
                     saveButton="{btnSave}"
                     validators="{new ArrayList([valQuantity, valHeight])}">
        <rfform:RFFormItem label="Type"
                           width="100%">
          <s:HGroup width="100%">
            <rfform:RFDropDownList id="rfcmbType"
                                   width="100%"
                                   originalValue="{siteEquipment.model.eqType}"
                                   dataProvider="{SiteEquipmentType.all}"
                                   change="rfcmbType_changeHandler(event)"/>
            <rfform:RFButton id="puType"
                             icon="@Embed(source='/Shared/src/assets/images/settings.png')"
                             width="30"
                             click="popupTypeOptions()"/>
          </s:HGroup>
        </rfform:RFFormItem>
      </rfform:RFForm>
    </components:RFTitleWindow>
    I've omitted a little bit of code, so please ask if you need anything that I didn't include.
    In regards to the RFDropDownList, originalValue is saved so that when a new selection is made, the new selection can be compared to the original value.  Setting originalValue sets the RFDropDownList's selectedItem to originalValue.
    When this window is first opened, a new instance of SiteEquipment is created.  Unless the equipment is new, the SiteEquipment instance sets the SiteEquipmentType to whatever has already been saved, using this line:
    eqType = SiteEquipmentType.selectFromObject(item.SITE_EQUIPMENT_TYPE);
    And here's the code from the SiteEquipmentType class:
    package components
      import common.UpdateStatus;
      import events.SiteEquipmentTypeEvent;
      import scripts.MyUtility;
      import flash.events.Event;
      import flash.events.EventDispatcher;
      import flash.utils.setTimeout;
      import mx.collections.ArrayCollection;
      import mx.collections.Sort;
      import mx.collections.SortField;
      import mx.controls.Alert;
      import mx.rpc.events.ResultEvent;
      import mx.utils.ObjectProxy;
      [Event(name="cacheChanged", type="flash.events.Event")]
      [Event(name="SITE_EQUIPMENT_TYPE_CREATE", type="events.SiteEquipmentTypeEvent")]
      [Event(name="SITE_EQUIPMENT_TYPE_EDIT", type="events.SiteEquipmentTypeEvent")]
      [Event(name="SITE_EQUIPMENT_TYPE_CANCEL", type="flash.events.Event")]
      public class SiteEquipmentType extends ObjectProxy
        public static const NEW_ID:int = -1;
        public static const SITE_EQUIPMENT_TYPE_CANCEL:String = "siteEquipmentTypeCancel";
        [Bindable]
        public var id:int = NEW_ID;
        [DefaultProperty]
        [Bindable]
        public var name:String = "";
        private static var dict:Object = new Object();
        private static var getAllServiceCalled:Boolean = false;
        private static var eventDispatcher:EventDispatcher = new EventDispatcher();
        private var updateStatus:UpdateStatus = UpdateStatus.COMPLETE;
        public function SiteEquipmentType(item:Object = null, keepInCache:Boolean = true)
          if (item == null)
            return;
          else if (item is int)
            id = int(item);
            refreshFromDb();
          else
            updateFromResult(item);
          if (keepInCache)
            addToCache(this);
        private static var _all:ArrayCollection = new ArrayCollection();
        public static function get all():ArrayCollection
          if (!getAllServiceCalled)
            getAllServiceCalled = true;
            MyUtility.httpPost("/page.aspx", {request:"SITE_EQUIPMENT_TYPE"}, getAll_result);
            var s:Sort = new Sort();
            s.fields = [new SortField("name", true)];
            _all.sort = s;
          return _all;
        public static function addEventListener(type:String, listener:Function):void
          eventDispatcher.addEventListener(type, listener);
        public static function removeEventListener(type:String, listener:Function):void
          eventDispatcher.removeEventListener(type, listener);
        public static function dispatchEvent(event:Event):Boolean
          return eventDispatcher.dispatchEvent(event);
        private static function addToCache(item:SiteEquipmentType):void
          removeFromCache(item.id);
          dict[item.id] = item;
          _all.addItem(item);
          dispatchEvent(new Event("cacheChanged"));
        private static function removeFromCache(id:int):void
          var item:SiteEquipmentType = dict[id];
          if (item)
            delete dict[id];
            _all.removeItemAt(_all.getItemIndex(item));
        public static function selectById(id:int):SiteEquipmentType
          if (dict[id])
            return dict[id];
          return new SiteEquipmentType(id);
        public static function selectFromObject(obj:Object):SiteEquipmentType
          var selected:SiteEquipmentType;
          var objId:int = obj.SITE_EQUIPMENT_TYPE_ID;
          if (dict[objId])
            selected = dict[objId];
            selected.updateFromResult(obj);
          else
            selected = new SiteEquipmentType(obj);
          return selected;
        private function updateFromResult(item:Object):void
          if (item)
            id = item.SITE_EQUIPMENT_TYPE_ID;
            name = item.SITE_EQUIPMENT_TYPE_NAME;
        private function toRequestObject():Object
          var o:Object = new Object();
          o.SITE_EQUIPMENT_TYPE_ID = id;
          o.SITE_EQUIPMENT_TYPE_NAME = name;
          return o;
        public function copy():SiteEquipmentType
          return new SiteEquipmentType(this.toRequestObject());
        public function save(value:SiteEquipmentType):void
          if (updateStatus == UpdateStatus.PENDING)
            Alert.show("Site Equipment Type is pending an update.", "Pending Update");
            return;
          else if (updateStatus == UpdateStatus.ERROR)
            Alert.show("There is a problem with this Site Equipment Type, and it cannot be saved. Please close the window.", "Save Failure");
            return;
          var request:Object;
          if (id == NEW_ID)
            if (value)
              request = value.toRequestObject();
            else
              request = toRequestObject();
            request._COMMAND = "INSERT";
          else
            if (value)
              request = MyUtility.objectDiff(this.toRequestObject(), value.toRequestObject());
              if (!request)
                dispatchEvent(new SiteEquipmentTypeEvent(SiteEquipmentTypeEvent.SITE_EQUIPMENT_TYPE_CREATE, this));
                return;
            else
              request = toRequestObject();
            request._COMMAND = "UPDATE";
            request._SITE_EQUIPMENT_TYPE_ID = id;
          delete request.SITE_EQUIPMENT_TYPE_ID;
          updateStatus = UpdateStatus.PENDING;
          MyUtility.httpPost("/updatetable.aspx?_SCHEMA=dbo&_TABLENAME=SITE_EQUIPMENT_TYPE&_RETURNRECORD=1", request, httpSave_result);
        public function toString():String
          return name;
        public function refreshFromDb():void
          if (updateStatus != UpdateStatus.PENDING)
            updateStatus = UpdateStatus.PENDING;
            MyUtility.httpPost("/page.aspx", {id:id, request:"Site_Equipment_Type"}, httpSelect_result);
        public function showEditForm(onCreate:Function = null, onEdit:Function = null, onCancel:Function = null):void
          if (id == 0)
            Alert.show("Edits are not allowed on this Site Equipment Type.", "Not Allowed");
            return;
          if (onCreate != null)
            addEventListener(SiteEquipmentTypeEvent.SITE_EQUIPMENT_TYPE_CREATE, onCreate);
          if (onEdit != null)
            addEventListener(SiteEquipmentTypeEvent.SITE_EQUIPMENT_TYPE_EDIT, onEdit);
          if (onCancel != null)
            addEventListener(SITE_EQUIPMENT_TYPE_CANCEL, onCancel);
          if (updateStatus == UpdateStatus.PENDING)
            setTimeout(showEditForm, 500);
          else if (updateStatus == UpdateStatus.COMPLETE)
            SiteEquipmentTypeEdit.open(this);
        public function cancelEdit():void
          dispatchEvent(new Event(SITE_EQUIPMENT_TYPE_CANCEL));
        private static function getAll_result(event:ResultEvent):void
          if (event.result.ROOT)
            if (event.result.ROOT.ERROR)
              Alert.show(event.result.ROOT.ERROR, "Error");
            else
              for each (var o:Object in MyUtility.ToArrayCollection(event.result.ROOT.SITE_EQUIPMENT_TYPE))
                var i:SiteEquipmentType = dict[o.SITE_EQUIPMENT_TYPE_ID];
                // If the Site Equipment Type is already in the cache, update it based on the XML returned
                if (i)
                  i.updateFromResult(o);
                  // Otherwise, create a new one from the XML returned
                else
                  i = new SiteEquipmentType(o);
              _all.refresh();
        private function httpSelect_result(event:ResultEvent):void
          if (event.result.ROOT)
            if (event.result.ROOT.ERROR)
              Alert.show(event.result.ROOT.ERROR, "Error");
              updateStatus = UpdateStatus.ERROR;
            else
              updateFromResult(event.result.ROOT.SITE_EQUIPMENT_TYPE);
              updateStatus = UpdateStatus.COMPLETE;
          else
            updateStatus = UpdateStatus.ERROR;
        private function httpSave_result(event:ResultEvent):void
          if (event.result.ROOT.ERROR)
            Alert.show(event.result.ROOT.ERROR, "Error");
            updateStatus = UpdateStatus.ERROR;
          else
            try
              updateStatus = UpdateStatus.COMPLETE;
              if (id == NEW_ID)
                id = event.result.ROOT.RESULTS.IDENTITY;
                addToCache(this);
                updateFromResult(event.result.ROOT["DBO.SITE_EQUIPMENT_TYPE"]);
                dispatchEvent(new SiteEquipmentTypeEvent(SiteEquipmentTypeEvent.SITE_EQUIPMENT_TYPE_CREATE, this));
              else
                updateFromResult(event.result.ROOT["DBO.SITE_EQUIPMENT_TYPE"]);
                dispatchEvent(new SiteEquipmentTypeEvent(SiteEquipmentTypeEvent.SITE_EQUIPMENT_TYPE_EDIT, this));
                SiteEquipmentType.dispatchEvent(new SiteEquipmentTypeEvent(SiteEquipmentTypeEvent.SITE_EQUIPMENT_TYPE_EDIT, this));
            catch(ex:Error)
              Alert.show(ex.message, "Error");
              updateStatus = UpdateStatus.ERROR;
    So the "_all" ArrayCollection serves as a cache of all of the different site equipment types.  When the edit window is first opened and a new instance of SiteEquipment is created, the SiteEquipmentType of the current SiteEquipment is added to _all and becomes the only SiteEquipmentType within _all.
    At this point, the DropDownList has the correct item selected.  The problem occurs when the result comes in from getting all of the SiteEquipmentTypes.  The contents of _all are flushed, and each SiteEquipmentType is added in.  Once this happens, the DropDownList will have nothing for selectedItem.
    I know this is quite complex, but any help would be greatly appreciated.

    Ok, I have this figured out now.  First, though, I'll point out that this worked fine when using MX components and the Halo theme; the problem only appeared after switching over to Spark components and the Spark theme.  Anyway, since this class functions as a singleton (as best I understand them), I added a boolean variable to the SiteEquipmentType class representing whether or not the results from the HTTPService call had come back and been inserted into _all.  So in the TitleWindow's init method, I only populated the DropDownList's originalValue (which in turn sets the selectedItem) if that variable is true.  The first time an instance of the TitleWindow component is opened, though, this variable will initially be false.  So back in the SiteEquipmentType class, I have it dispatch an event right after setting the variable to true, and the TitleWindow componet will add a listener for this event if the variable is originally false.  If anyone needs further explanation, please ask.

  • Spark.effects.Fade and effectEnd (Gumbo)

    Hello all,
    I'm sure this is going to be a really daft question and I'll slap my head when someone points me in the right direction, but I can't seem to figure it out... Basically I'm trying to use the spark.effects.Fade class on a sprite that I have - that works no problem at all (it's surprisingly verbose though in AS3). But what I can't seem to do is add a handler for when the effect ends (effectEnd).
    The documentation ( http://help.adobe.com/en_US/Flex/4.0/langref/spark/effects/Fade.html - which is largely MXML orientated from what I can see) suggests that effectEnd is inherited from mx.effects.Effect - could this be where the issue is coming in. Do I need to cast the Fade object?
    This is the code that I'm using at the moment:
    var fadeAni:spark.effects.Fade = new spark.effects.Fade( );
    fadeAni.target = _tip;
    fadeAni.alphaFrom = 1;
    fadeAni.alphaTo = 0;
    fadeAni.duration = 500;
    fadeAni.effectEnd =function ( e:Event ) {
        removeChild( _tip );
        _tip = null;
    fadeAni.play();
    And with that mxmlc says:
    $ mxmlc app.mxml
    Loading configuration file /usr/local/flex_sdk_4.0.0.10485/frameworks/flex-config.xml
    /Users/allan/Desktop/Flex/flex_test/components/ToolTip.as(130): col: 13 Error: Access of possibly undefined property effectEnd through a reference with static type spark.effects:Fade.
    fadeAni.effectEnd =function ( e:Event ){
    Many thanks,
    Allan

    This is all correct, but here's a couple of tips for de-verbosifying effects:
    - You don't need an "alphaFrom" if the sprite already has the alpha value you want - it will pick up the current value as the value it starts from.
    - You don't need a 'duration' if you're animating for 500 ms - that's the default
    - Fade works with the state values when used in a transition. So, for example, if an object exists in one state and is removed in the next state, then a transition with a Fade (no arguments declared) on the target will automatically fade it out. Examples on this here:
    http://graphics-geek.blogspot.com/2009/08/video-fade-effect-in-flex-4.html
    (yes, this is an mxml solution, or at least a solution that involves states, as opposed to the dynamic approach in the Allan's original example, but it seemed worth mentioning, because effects are tuned to be particularly simple when used in transitions).
    Chet.

  • How to push a view to another view to a specific State in Mobile App?

    I want to open a second view that contains some states from the first view.
    Example: myFirstView  with a spark list component:
    So far I got this code for the view of the list to push to the other views:
    <fx:Script>
            <![CDATA[
                import spark.events.IndexChangeEvent;
                protected function selectionChangingHandler(event:IndexChangeEvent):void
                    if(myList.selectedIndex == 0){
                        navigator.pushView(mysecondView);
                    } else if (myList.selectedIndex == 1){
                        navigator.pushView(myThirdView);
                    } else if (myList.selectedIndex == 2){
                        navigator.pushView(myFouthView);
            ]]>
    <s:List id="myList" width="100%" height="100%"
                alternatingItemColors="[#EEEEEE, #E3E3E3]" change="selectionChangingHandler(event)">
                <s:dataProvider>
                    <s:ArrayList>
                        <fx:Object label="newView 1" />
                        <fx:Object label="newView 2" />
                        <fx:Object label="newView 3" />
                    </s:ArrayList>
                </s:dataProvider>
            </s:List>
    This code push to the views but I need to go to  any of the states in each view.
    And mysecondview  let's say with 3 States:
    <s:State name="myState1"/>
    <s:State name="myState2"/>
    <s:State name="myState3"/>
    From the fisrt view list to go, let's say to mySecondView > myState 1, 2 or 3
    Any help?
    Hope is wel explained
    Thanks in advance

    Hi,
       I am having view1 and view2.
      in view1 i am using roadmap. S1 is one of the step of road map.
      in view1 i used this code to get the reference of this view in componentcontroller attribute
    Data: lo_api TYPE REF TO if_wd_view_controller.
    If first_time = 'X'.
    lo_api = wd_this->wd_get_api( ).
    wd_Comp_Controller->my_VIEW = lo_api.
    endif.
    in my view2 i want to access the roadmap step
    i dono how to access that.. i used this code.......
             wd_comp_controller->my_view->get_element( 'S1' ).
    is this correct.. If not what is the code to get that id..
    Can any one tell me clearly...

Maybe you are looking for

  • T code MB5B , the storage location will be reset

    dear All, I want to see stock on posting date of particular storage location with values. When i try T code MB5B and select valuated stock, (it says storage location will be reset). and i used another T code MC.9 and MC49 , but these T codes didn't m

  • How to capture the user activities in Project Server 2010

    Hi I want  to capture the user activities from Project Server 2010 like when a user has saved and published etc. Is there any possibility that we can get the user activities data from sql server. Please throw some light on the same. Thanks Geeth If y

  • SSI shows up correctly in DW but doesn't show up in browser.

    I am trying to update the company website here at work using Dreamweaver 4 and the copyright information at the bottom of the page is in an ssi file. The file shows up fine in Dreamweaver but doesn't show up at all in either of my browers (Safari/Fir

  • My mac book is working slow

    sir i have purchased my mac book air in january 2014..... and in the bignning it is working very fast .... but now it is working slow .... and some times it hangs also .... so please give some solution to make my mac book same as before.... thank you

  • Printing Smartform on Letterhead Duplex

    Hi, I have a 2 page smartform that I am printing onto a letterhead and the paper is loaded so that the letterhead is aligned. I have now created another 1 page smartform, but when I print it it appears on the reverse of the letterhead. The printer is