2 Replies Latest reply on Dec 10, 2009 5:58 PM by mliyanagamage

    Adobe Air button glitch?

    mliyanagamage

      I am making an adobe air app. I use the standard buttons to change between the servral states that I have in the app. I am using some transitions to bounce the buttons and other components around. For some reason I need a double click to navigate between states. A single click works the first time but after that I need to use double clicking on the buttons. Please HELP

       

      Also If it turns out that the transition is what is causing this behavior then can anyone give me code for a simple transition between one state to another on button click. The transition effect should be a standard fade in and out and it should target every component I have.

       

      Help on both subjects is appreciated.

       

      Thanks ahead

        • 1. Re: Adobe Air button glitch?
          Gregory Lafrance Level 6

          If this post answers your question or helps, please mark it as such.


          Greg Lafrance
          www.ChikaraDev.com

          Flex Development and Support Services

          The following code works on single clicks, but it does not wor the first time. Don't know why.

           

           

          <?xml version="1.0" encoding="utf-8"?>
          <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml">
            <mx:Script>
              <![CDATA[
              ]]>
            </mx:Script>
            <mx:Button id="toBlueBtn" label="To Blue State" click="currentState='blueState'"/>
            <mx:VBox id="redVB" width="100" height="100" backgroundColor="0xFF0000"/>
            <mx:states>
              <mx:State name="blueState">
                <mx:AddChild>
                  <mx:Button id="toRedBtn" label="To Red State" click="currentState=''"/>
                </mx:AddChild>
                <mx:AddChild>
                  <mx:VBox id="blueVB" width="100" height="100" backgroundColor="0x0000FF"/>
                </mx:AddChild>
                <mx:RemoveChild target="{toBlueBtn}"/>
                <mx:RemoveChild target="{redVB}"/>
              </mx:State>
            </mx:states>
            <mx:transitions>
              <mx:Transition fromState="*" toState="blueState">
                <mx:Sequence>
                  <mx:Fade targets="{[toBlueBtn, redVB]}" alphaFrom="1" alphaTo="0" duration="500"/>      
                  <mx:Fade targets="{[toRedBtn, blueVB]}" alphaFrom="0" alphaTo="1" duration="500"/>      
                </mx:Sequence>
              </mx:Transition>
              <mx:Transition fromState="blueState" toState="*">
                <mx:Sequence>
                  <mx:Fade targets="{[toRedBtn, blueVB]}" alphaFrom="1" alphaTo="0" duration="500"/>      
                  <mx:Fade targets="{[toBlueBtn, redVB]}" alphaFrom="0" alphaTo="1" duration="500"/>      
                </mx:Sequence>
              </mx:Transition>
            </mx:transitions>
          </mx:WindowedApplication>
          
          
          • 2. Re: Adobe Air button glitch?
            mliyanagamage Level 1

            Yeah that transition works great, but the first time I click on the button the blue box appears without a transition, but after the first click, the clicks that follow make the transition work. Is there any fix for that?