+////////////////////////////////////////////////////////////////////////////////
+//
+//  ADOBE SYSTEMS INCORPORATED
+//  Copyright 2010 Adobe Systems Incorporated
+//  All Rights Reserved.
+//
+//  NOTICE: Adobe permits you to use, modify, and distribute this file
+//  in accordance with the terms of the license agreement accompanying it.
+//
+////////////////////////////////////////////////////////////////////////////////
+
 package spark.effects
 {
 import flash.display.BitmapData;
-import flash.display.Sprite;
 
 import mx.core.IVisualElementContainer;
 import mx.core.UIComponent;

     * 
     * @param event The effect complete event dispatched by the single
     * parallel effect this transition plays.
     */
    override public function transitionComplete(event:EffectEvent=null):void
    {
        event.target.removeEventListener(EffectEvent.EFFECT_END, transitionComplete);
        
        if (currentView)
        {
            currentView.includeInLayout = true;
            currentView.cacheAsBitmap = false;
        }
        
        if (nextView)
        {
            nextView.includeInLayout = true;
            nextView.cacheAsBitmap = false;
        }
        
        if (doInternalActionBarAnimation)
        {
            if (actionBar.titleGroup)
                actionBar.titleGroup.cacheAsBitmap = false;
            
            if (cachedTitleGroup)
            {
                if (actionBar.skin is IVisualElementContainer)
                    IVisualElementContainer(actionBar.skin).removeElement(cachedTitleGroup);
                else
                    actionBar.skin.removeChild(cachedTitleGroup);
                
                cachedTitleGroup = null;
            }
            
            if (cachedNavigationGroup)
            {
                if (actionBar.skin is IVisualElementContainer)
                    IVisualElementContainer(actionBar.skin).removeElement(cachedNavigationGroup);
                else
                    actionBar.skin.removeChild(cachedNavigationGroup);
                
                actionBar.navigationGroup.cacheAsBitmap = false;
                cachedNavigationGroup = null;
            }
            
            if (cachedActionGroup)
            {
                if (actionBar.skin is IVisualElementContainer)
                    IVisualElementContainer(actionBar.skin).removeElement(cachedActionGroup);
                else
                    actionBar.skin.removeChild(cachedActionGroup);
                
                actionBar.actionGroup.cacheAsBitmap = false;
                cachedActionGroup = null;
            }
        }
        else
        {
            if (cachedActionBar)
            {
                if (navigator.skin is IVisualElementContainer)
                    IVisualElementContainer(navigator.skin).removeElement(cachedActionBar)
                else
                    navigator.skin.removeChild(cachedActionBar);
                
                cachedActionBar = null;
            }
        }
        
        if (cachedTabBar)
        {
            if (navigator.skin is IVisualElementContainer)
                IVisualElementContainer(navigator.skin).removeElement(cachedTabBar);
            else
                navigator.skin.removeChild(cachedTabBar);
            
            cachedTabBar = null;
        }
        
        // Remove items from layout
        navigator.contentGroup.includeInLayout = contentGroupExplicitIncludeInLayout;
        
        if (actionBar)
            navigator.actionBar.includeInLayout = actionBarExplicitIncludeInLayout;
        
        if (tabBar)
            tabBar.includeInLayout = tabBarExplicitIncludeInLayout;

        // TODO (chiedozi): Comment why clean up happens before transitionComplete
        super.transitionComplete(event);
        effect = null;
    }
    
    //--------------------------------------------------------------------------

    //
    //--------------------------------------------------------------------------
    
    [Inspectable(category="General", enumeration="left, right", defaultValue="left")]
    /**
     *  The direction of the slide animation.  Can be either "left" or "right".
     * 
     *  @langversion 3.0
     *  @playerversion Flash 10
     *  @playerversion AIR 2.5
     *  @productversion Flex 4.5
     */
    public var direction:String = SLIDE_LEFT;
    
    //--------------------------------------------------------------------------
    //
