@@ -309,6 +309,16 @@ package feathers.controls.supportClasses
309309 this . invalidate (INVALIDATION_FLAG_SIZE );
310310 }
311311
312+ /**
313+ * @private
314+ */
315+ protected var _waitingTransition : Function ;
316+
317+ /**
318+ * @private
319+ */
320+ private var _waitingForTransitionFrameCount : int = 1 ;
321+
312322 /**
313323 * @private
314324 */
@@ -602,7 +612,14 @@ package feathers.controls.supportClasses
602612 }
603613 if (transition != null )
604614 {
605- transition(this . _previousScreenInTransition , this . _activeScreen , transitionComplete);
615+ //temporarily make the active screen invisible because the
616+ //transition doesn't start right away.
617+ this . _activeScreen . visible = false ;
618+ this . _waitingForTransitionFrameCount = 0 ;
619+ this . _waitingTransition = transition;
620+ //this is a workaround for an issue with transition performance.
621+ //see the comment in the listener for details.
622+ this . addEventListener (Event . ENTER_FRAME , waitingForTransition_enterFrameHandler);
606623 }
607624 else
608625 {
@@ -646,7 +663,12 @@ package feathers.controls.supportClasses
646663 {
647664 this . dispatchEventWith(FeathersEventType. TRANSITION_START );
648665 this . _previousScreenInTransition . dispatchEventWith(FeathersEventType. TRANSITION_OUT_START );
649- transition(this . _previousScreenInTransition , null , transitionComplete);
666+
667+ this . _waitingForTransitionFrameCount = 0 ;
668+ this . _waitingTransition = transition;
669+ //this is a workaround for an issue with transition performance.
670+ //see the comment in the listener for details.
671+ this . addEventListener (Event . ENTER_FRAME , waitingForTransition_enterFrameHandler);
650672 }
651673 this . invalidate (INVALIDATION_FLAG_SELECTED );
652674 }
@@ -764,5 +786,31 @@ package feathers.controls.supportClasses
764786 {
765787 this . invalidate (INVALIDATION_FLAG_SIZE );
766788 }
789+
790+ /**
791+ * @private
792+ */
793+ private function waitingForTransition_enterFrameHandler (event :Event ):void
794+ {
795+ //we need to wait a couple of frames before we can start the
796+ //transition to make it as smooth as possible. this feels a little
797+ //hacky, to be honest, but I can't figure out why waiting only one
798+ //frame won't do the trick. the delay is so small though that it's
799+ //virtually impossible to notice.
800+ if (this . _waitingForTransitionFrameCount < 2 )
801+ {
802+ this . _waitingForTransitionFrameCount ++;
803+ return ;
804+ }
805+ this . removeEventListener (Event . ENTER_FRAME , waitingForTransition_enterFrameHandler);
806+ if (this . _activeScreen )
807+ {
808+ this . _activeScreen . visible = true ;
809+ }
810+
811+ var transition: Function = this . _waitingTransition ;
812+ this . _waitingTransition = null ;
813+ transition(this . _previousScreenInTransition , this . _activeScreen , transitionComplete);
814+ }
767815 }
768816}
0 commit comments