 
 package spark.effects.supportClasses
 {
+import flash.display.DisplayObject;
+import flash.geom.PerspectiveProjection;
+import flash.geom.Point;
 import flash.geom.Vector3D;
 
+import mx.core.ILayoutElement;
 import mx.core.mx_internal;
 import spark.effects.animation.Animation;
 import mx.effects.Effect;
 import spark.effects.Animate;
 import spark.effects.easing.IEaser;
 import spark.effects.easing.Linear;
+
+import mx.core.UIComponent;
 
 import spark.effects.KeyFrame;
 import spark.effects.MotionPath;

    /**
     *  @private
     */
    private static var TRANSFORM_PROPERTIES:Array =
        ["translationX", "translationY", "translationZ", 
         "rotationX", "rotationY", "rotationZ", 
         "scaleX", "scaleY", "scaleZ"];

    /**
     *  Flag to indicate that this single instance of the transform-related

    /**
     * @private
     * 
     */
    override public function animationStart(animation:Animation):void
    {
        initProjection();
        super.animationStart(animation);
    }
    
    /**
     * @private
     * 
     */
    override public function animationEnd(animation:Animation):void
    {
        removeProjection();
        super.animationEnd(animation);
    }

  
    /**
     * @private
     * 
     * The superclass version of getCurrentValue() will only get values that
     * actually exist on the target (as properties or styles). But we need to
     * be able to get the translationXYZ values, which are fake values that
     * we derive from the transform-related properties of the target.
     * So we override this function to calculate and return the translation
     * values appropriately. 
     */     
    override protected function getCurrentValue(property:String):*
    {
        // TODO (chaase): we're recalculating the transform for every 
        // component of the translation. We should store/retrieve the
        // translation property as a structure instead of separate values
		switch(property)
		{
			
			case "translationX":
			case "translationY":
			case "translationZ":
	        {
	            var position:Vector3D = new Vector3D();
	            var xformCenter:Vector3D = (transformCenter) ? 
	                transformCenter : 
	                defaultTransformCenter;
	            target.transformPointToParent(xformCenter,
	                position, null);
	            if (property == "translationX")
	                return position.x;               
	            if (property == "translationY")
	                return position.y;               
	            if (property == "translationZ")
	                return position.z;
	            break;
	        }			
	        case "postLayoutTranslationX":
			case "postLayoutTranslationY":
			case "postLayoutTranslationZ":
	        {
	            var postLayoutPosition:Vector3D = new Vector3D();
	            xformCenter  = (transformCenter) ? 
	                transformCenter : 
	                defaultTransformCenter;
	            target.transformPointToParent(xformCenter,
	                null, postLayoutPosition);
	            if (property == "postLayoutTranslationX")
	                return postLayoutPosition.x;               
	            if (property == "postLayoutTranslationY")
	                return postLayoutPosition.y;               
	            if (property == "postLayoutTranslationZ")
	                return postLayoutPosition.z;
	            break;
	        }
	        case "postLayoutRotationX":
	        	return (target.offsets == null)? 0:target.offsets.rotationX;
	        case "postLayoutRotationY":
	        	return (target.offsets == null)? 0:target.offsets.rotationY;
	        case "postLayoutRotationZ":
	        	return (target.offsets == null)? 0:target.offsets.rotationZ;
	        case "postLayoutScaleX":
	        	return (target.offsets == null)? 1:target.offsets.scaleX;
	        case "postLayoutScaleY":
	        	return (target.offsets == null)? 1:target.offsets.scaleY;
	        case "postLayoutScaleZ":
	        	return (target.offsets == null)? 1:target.offsets.scaleZ;
	     	default:
	            return super.getCurrentValue(property);
        }
    }

