Monthly Archives: October, 2010

Interrupting Transitions in Flex 4.5 (Hero)

If you have picked up one of the Flex SDK team’s stable 4.5 Hero builds in July or September, you may not have noticed an itty-bitty feature added to Flex Transitions back in May by Chet Haas before he departed to do Android development. A new property, interruptionBehavior, was added to the Transition class. Here is a description of the property in our ASDocs:

“This property controls how this transition behaves with respect to any currently-running transition. By default, the current transition will end, which snaps all values to their end values. This was the default behavior as of Flex 4, before this property existed. But if the value “stop” is selected for this property, the previous transition will stop in place, leaving values where they are and the next transition will start with those values.

This property takes precedence over the autoReverse property, so that if interruptionBehavior is set to “stop” on a transition, that transition will stop a running transition in place and will be played, even if the previous transition is the reverse of the new one.

The default value is InterruptionBehavior.END."

Personally, I think that this new feature makes effects oooohhh-sooo-much smoother! In Flex 4, if you were jumping between various states, you would get jerky animations because the effect was jumping to the end before starting the next transition. Now, when interruptionBehavior=”stop”, the effect will stop and then continue to play the next transition from its last state.

However, I lied when I said that this was an itty-bitty feature. In fact, I think that the number of permutations that this property can be used in are endless. You can do so much with different effects, on different targets, with different states etc. I’m sure our customers are doing some pretty crazy, creative stuff with effects. My guess is that interrupting some of your more complicated use cases won’t work. So, seeing as I am slated for testing this feature and I care deeply about quality, I hope you can help me. When I am out at community events, many people are saying how they want to help, but, often times, we make it difficult. Well, I’m asking for your help to give these transition interruptions a dance around the block. File bugs or just comment if you find something that doesn’t work. I’m sure I will miss something and would appreciate your kind feedback.

Here is a little app demonstrating the use of interruptionBehavior along with autoReverse in Flex 4.5 transitions.

Sample SWF: InterruptionExample.swf

Sample MXML: InterruptionExample.mxml