4 Replies Latest reply on Jan 26, 2011 11:54 PM by Ed@SF

    Trigger transition similar to "on application start" (no user action)

    Ed@SF Level 1

      Structure:

       

      State 1 -> State 2 -> State 3....and so on.

       

      • On application start there is a simple transition from State 1 -> State 2
      • From anywhere in the application (i.e. State 3):
        • how would one add interaction that goes to State 1 and transition to State 2?
        • am currently "limited" to transitioning to State 2 from anywhere else, but this isn't the intended result

       

       

      If this is easily done in Catalyst, and I'm just not seeing it, please do tell...

       

      Otherwise, yes, am very new to Catalyst/Flex, but am not new to AS3/Flash....so if this requires some Flex/MXML/AS3 work, I think I should be able to follow instruction

       

      Thanks for any input.

       

      Ed

        • 1. Re: Trigger transition similar to "on application start" (no user action)
          Ed@SF Level 1
          • am currently "limited" to transitioning to State 2 from anywhere else, but this isn't the intended result

             

            Just to clarify the above. "limited" isn't a "technical limitation"...I should have said "workaround", simply because State 2 makes more sense to my application. I can send users to State 1...but it wouldn't make sense (it needs the transition to State 2).

            • 2. Re: Trigger transition similar to "on application start" (no user action)
              Chris W. Griffith Adobe Community Professional

              Ok here is how to 'auto-trigger' state changes in a Flash Catalyst project

               

              You will need to open your Flash Catalyst project in Flash Builder, so if you are using 1.0 this is a one way trip (so consider yourself warned). With 1.5 'Panini', you should be able to re-open the file back in Flash Catalyst (but is it a preview release, so promises).

               

              In main.mxml file, locate the <s:transitions> portion of the code. You should see a set of nested tags that define each state to state transition. At the first tag after the <s:transitions> (it should be either a <s:Parallel or <s:Sequence tag), at the end of the tag add the following attribute:

               

                 effectEnd="state1_effectEndHandler(event)"

               

               

              Original Tag:

               

              <s:Parallel>

              New Tag:

               

              <s:Parallel effectEnd="parallel1_effectEndHandler(event)">

               

               

              Now in the <fx:Script> portion of the mxml file, you will need to add an event handler:

               

               

              protected function parallel1_effectEndHandler(event:EffectEvent):void

              {

                   currentState='Page2'

              }

               

               

              where Page2 is the name of the next state you want to transition to.

               

               

              You can continue to follow this pattern to chain more together by added the effectEnd attribute to the next set of transitions, and adding matching event handlers

               

              I have attached a simple demo. Click on the button to trigger going from state 1 to state 2, it should auto transition to state 3. You will need to open it in Flash Builder.

               

              Chris

              • 3. Re: Trigger transition similar to "on application start" (no user action)
                Ed@SF Level 1

                Hi Chris,

                 

                Thank you for the caveats - I'll create a backup first. I'll assume I have 1.0 (cs5)...not one to use preview versions on production stuff....BUT yes, tool newbie using on production stuff - how else would one really learn right? Nothing like the feeling of sweating bullets!

                 

                Interesting, "looks" like wpf...feel a bit (over) confident now....

                 

                I'll report back to you when I get to it....if I don't, probably a miserable death...thanks!

                 

                Ed

                • 4. Re: Trigger transition similar to "on application start" (no user action)
                  Ed@SF Level 1

                  Chris,

                   

                  Worked out perfectly - THANK YOU.

                   

                  This is literally the first time I've used FB4 and am already pretty impressed by the way this IDE works. Didn't really have to worry about the catalyst file since FB essentially creates its own project (non desctructve to catalyst file - but yes I do understand that if I make changes to the FC file, I'll have to redo the FB work).

                   

                  Now I just have to figure out why one specific state transition wasn't in the <transitions /> element - not an issue, I pretty much just hand coded the xml in for it...but if you have more insight to why this might be, that would be great...

                   

                  More info on this "strange" behavior:

                  • the transition exists in FC
                  • there are no effects/smooth transitions applied (so its a "hard" transition)
                  • this specific transition isn't found in the FB xml.....

                   

                  Ed