script/record_mic/com/eclecticdesignstudio/motion/Actuate.as
author ymh <ymh.work@gmail.com>
Thu, 07 Jun 2012 18:27:36 +0200
changeset 29 d733ad1f2654
parent 11 6cab7e0b1678
permissions -rw-r--r--
better localize thumnail generation
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
     1
package com.eclecticdesignstudio.motion {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
     2
	
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
     3
	
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
     4
	import com.eclecticdesignstudio.motion.actuators.GenericActuator;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
     5
	import com.eclecticdesignstudio.motion.actuators.MethodActuator;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
     6
	import com.eclecticdesignstudio.motion.actuators.MotionInternal;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
     7
	import com.eclecticdesignstudio.motion.actuators.MotionPathActuator;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
     8
	import com.eclecticdesignstudio.motion.actuators.SimpleActuator;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
     9
	import com.eclecticdesignstudio.motion.actuators.TransformActuator;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    10
	import com.eclecticdesignstudio.motion.easing.Expo;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    11
	import com.eclecticdesignstudio.motion.easing.IEasing;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    12
	import flash.display.DisplayObject;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    13
	import flash.events.Event;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    14
	import flash.utils.Dictionary;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    15
	
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    16
	
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    17
	use namespace MotionInternal;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    18
	
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    19
	
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    20
	/**
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    21
	 * @author Joshua Granick
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    22
	 * @version 1.23
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    23
	 */
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    24
	public class Actuate {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    25
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    26
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    27
		public static var defaultActuator:Class = SimpleActuator;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    28
		public static var defaultEase:IEasing = Expo.easeOut;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    29
		private static var targetLibraries:Dictionary = new Dictionary (true);
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    30
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    31
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    32
		/**
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    33
		 * Copies properties from one object to another. Conflicting tweens are stopped automatically
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    34
		 * @example		<code>Actuate.apply (MyClip, { alpha: 1 } );</code>
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    35
		 * @param	target		The object to copy to
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    36
		 * @param	properties		The object to copy from
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    37
		 * @param	customActuator		A custom actuator to use instead of the default (Optional)
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    38
		 * @return		The current actuator instance, which can be used to apply properties like onComplete or onUpdate handlers
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    39
		 */
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    40
		public static function apply (target:Object, properties:Object, customActuator:Class = null):GenericActuator {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    41
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    42
			stop (target, properties);
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    43
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    44
			var actuateClass:Class = customActuator || defaultActuator;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    45
			var actuator:GenericActuator = new actuateClass (target, 0, properties);
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    46
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    47
			actuator.MotionInternal::apply ();
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    48
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    49
			return actuator;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    50
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    51
		}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    52
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    53
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    54
		/**
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    55
		 * Creates a new effects tween 
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    56
		 * @param	target		The object to tween
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    57
		 * @param	duration		The length of the tween in seconds
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    58
		 * @param	overwrite		Sets whether previous tweens for the same target and properties will be overwritten (Default is true)
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    59
		 * @return		An EffectsOptions instance, which is used to select the kind of effect you would like to apply to the target
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    60
		 */
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    61
		public static function effects (target:DisplayObject, duration:Number, overwrite:Boolean = true):EffectsOptions {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    62
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    63
			return new EffectsOptions (target, duration, overwrite);
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    64
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    65
		}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    66
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    67
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    68
		private static function getLibrary (target:Object):Dictionary {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    69
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    70
			if (!targetLibraries[target]) {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    71
				
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    72
				targetLibraries[target] = new Dictionary (true);
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    73
				
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    74
			}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    75
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    76
			return targetLibraries[target];
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    77
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    78
		}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    79
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    80
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    81
		/**
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    82
		 * Creates a new MotionPath tween
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    83
		 * @param	target		The object to tween
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    84
		 * @param	duration		The length of the tween in seconds
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    85
		 * @param	properties		An object containing a motion path for each property you wish to tween
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    86
		 * @param	overwrite		Sets whether previous tweens for the same target and properties will be overwritten (Default is true)
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    87
		 * @return		The current actuator instance, which can be used to apply properties like ease, delay, onComplete or onUpdate
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    88
		 */
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    89
		public static function motionPath (target:Object, duration:Number, properties:Object, overwrite:Boolean = true):GenericActuator {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    90
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    91
			return tween (target, duration, properties, overwrite, MotionPathActuator);
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    92
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    93
		}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    94
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    95
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    96
		/**
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    97
		 * Pauses tweens for the specified target objects
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    98
		 * @param	... targets		The target objects which will have their tweens paused. Passing no value pauses tweens for all objects
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
    99
		 */
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   100
		public static function pause (... targets:Array):void {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   101
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   102
			var actuator:GenericActuator;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   103
			var library:Dictionary;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   104
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   105
			if (targets.length > 0) {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   106
				
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   107
				for each (var target:Object in targets) {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   108
					
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   109
					library = getLibrary (target);
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   110
					
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   111
					for each (actuator in library) {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   112
						
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   113
						actuator.MotionInternal::pause ();
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   114
						
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   115
					}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   116
					
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   117
				}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   118
				
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   119
			} else {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   120
				
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   121
				for each (library in targetLibraries) {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   122
					
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   123
					for each (actuator in library) {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   124
						
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   125
						actuator.MotionInternal::pause ();
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   126
						
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   127
					}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   128
					
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   129
				}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   130
				
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   131
			}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   132
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   133
		}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   134
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   135
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   136
		/**
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   137
		 * Resets Actuate by stopping and removing tweens for all objects
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   138
		 */
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   139
		public static function reset ():void {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   140
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   141
			var actuator:GenericActuator;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   142
			var library:Dictionary;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   143
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   144
			for each (library in targetLibraries) {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   145
				
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   146
				for each (actuator in library) {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   147
					
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   148
					actuator.MotionInternal::stop (null, false, false);
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   149
					
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   150
				}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   151
				
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   152
			}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   153
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   154
			targetLibraries = new Dictionary (true);
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   155
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   156
		}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   157
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   158
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   159
		/**
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   160
		 * Resumes paused tweens for the specified target objects
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   161
		 * @param	... targets		The target objects which will have their tweens resumed. Passing no value resumes tweens for all objects
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   162
		 */
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   163
		public static function resume (... targets:Array):void {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   164
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   165
			var actuator:GenericActuator;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   166
			var library:Dictionary;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   167
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   168
			if (targets.length > 0) {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   169
				
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   170
				for each (var target:Object in targets) {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   171
					
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   172
					library = getLibrary (target);
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   173
					
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   174
					for each (actuator in library) {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   175
						
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   176
						actuator.MotionInternal::resume ();
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   177
						
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   178
					}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   179
					
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   180
				}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   181
				
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   182
			} else {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   183
				
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   184
				for each (library in targetLibraries) {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   185
					
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   186
					for each (actuator in library) {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   187
						
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   188
						actuator.MotionInternal::resume ();
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   189
						
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   190
					}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   191
					
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   192
				}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   193
				
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   194
			}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   195
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   196
		}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   197
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   198
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   199
		/**
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   200
		 * Stops all tweens for an individual object
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   201
		 * @param	target		The target object which will have its tweens stopped
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   202
		 * @param  properties		A string, array or object which contains the properties you wish to stop, like "alpha", [ "x", "y" ] or { alpha: null }. Passing no value removes all tweens for the object (Optional)
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   203
		 * @param	complete		If tweens should apply their final target values before stopping. Default is false (Optional) 
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   204
		 */
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   205
		public static function stop (target:Object, properties:Object = null, complete:Boolean = false):void {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   206
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   207
			if (target) {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   208
				
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   209
				var actuator:GenericActuator;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   210
				var library:Dictionary = getLibrary (target);
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   211
				
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   212
				var temp:Object;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   213
				
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   214
				if (properties is String) {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   215
					
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   216
					temp = new Object ();
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   217
					temp[properties] = null;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   218
					properties = temp;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   219
					
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   220
				} else if (properties is Array) {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   221
					
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   222
					temp = new Object ();
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   223
					
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   224
					for each (var propertyName:String in properties) {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   225
						
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   226
						temp[propertyName] = null;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   227
						
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   228
					}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   229
					
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   230
					properties = temp;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   231
					
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   232
				}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   233
				
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   234
				for each (actuator in library) {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   235
					
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   236
					actuator.MotionInternal::stop (properties, complete, true);
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   237
					
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   238
				}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   239
				
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   240
			}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   241
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   242
		}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   243
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   244
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   245
		/**
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   246
		 * Creates a tween-based timer, which is useful for synchronizing function calls with other animations
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   247
		 * @example		<code>Actuate.timer (1).onComplete (trace, "Timer is now complete");</code>
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   248
		 * @param	duration		The length of the timer in seconds
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   249
		 * @param	customActuator		A custom actuator to use instead of the default (Optional)
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   250
		 * @return		The current actuator instance, which can be used to apply properties like onComplete or to gain a reference to the target timer object
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   251
		 */
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   252
		public static function timer (duration:Number, customActuator:Class = null):GenericActuator {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   253
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   254
			return tween (new TweenTimer (0), duration, new TweenTimer (1), false, customActuator);
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   255
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   256
		}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   257
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   258
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   259
		/**
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   260
		 * Creates a new transform tween
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   261
		 * @example		<code>Actuate.transform (MyClip, 1).color (0xFF0000);</code>
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   262
		 * @param	target		The object to tween
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   263
		 * @param	duration		The length of the tween in seconds
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   264
		 * @param	overwrite		Sets whether previous tweens for the same target and properties will be overwritten (Default is true)
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   265
		 * @return		A TransformOptions instance, which is used to select the kind of transform you would like to apply to the target
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   266
		 */
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   267
		public static function transform (target:Object, duration:Number = 0, overwrite:Boolean = true):TransformOptions {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   268
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   269
			return new TransformOptions (target, duration, overwrite);
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   270
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   271
		}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   272
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   273
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   274
		/**
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   275
		 * Creates a new tween
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   276
		 * @example		<code>Actuate.tween (MyClip, 1, { alpha: 1 } ).onComplete (trace, "MyClip is now visible");</code>
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   277
		 * @param	target		The object to tween
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   278
		 * @param	duration		The length of the tween in seconds
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   279
		 * @param	properties		The end values to tween the target to
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   280
		 * @param	overwrite			Sets whether previous tweens for the same target and properties will be overwritten (Default is true)
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   281
		 * @param	customActuator		A custom actuator to use instead of the default (Optional)
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   282
		 * @return		The current actuator instance, which can be used to apply properties like ease, delay, onComplete or onUpdate
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   283
		 */ 
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   284
		public static function tween (target:Object, duration:Number, properties:Object, overwrite:Boolean = true, customActuator:Class = null):GenericActuator {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   285
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   286
			if (target) {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   287
				
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   288
				if (duration > 0) {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   289
					
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   290
					var actuateClass:Class = customActuator || defaultActuator;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   291
					var actuator:GenericActuator = new actuateClass (target, duration, properties);
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   292
					
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   293
					var library:Dictionary = getLibrary (actuator.target);
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   294
					
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   295
					if (overwrite) {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   296
						
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   297
						for each (var childActuator:GenericActuator in library) {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   298
							
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   299
							childActuator.MotionInternal::stop (actuator.properties, false, false);
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   300
							
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   301
						}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   302
						
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   303
					}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   304
					
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   305
					library[actuator] = actuator;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   306
					actuator.MotionInternal::move ();
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   307
					
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   308
					return actuator;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   309
					
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   310
				} else {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   311
					
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   312
					return apply (target, properties, customActuator);
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   313
					
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   314
				}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   315
				
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   316
			}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   317
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   318
			return null;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   319
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   320
		}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   321
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   322
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   323
		MotionInternal static function unload (actuator:GenericActuator):void {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   324
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   325
			var library:Dictionary = getLibrary (actuator.target);
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   326
			delete library[actuator];
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   327
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   328
		}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   329
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   330
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   331
		/**
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   332
		 * Creates a new tween that updates a method rather than setting the properties of an object
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   333
		 * @example		<code>Actuate.update (trace, 1, ["Value: ", 0], ["", 1]).onComplete (trace, "Finished tracing values between 0 and 1");</code>
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   334
		 * @param	target		The method to update		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   335
		 * @param	duration		The length of the tween in seconds
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   336
		 * @param	start		The starting parameters of the method call. You may use both numeric and non-numeric values
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   337
		 * @param	end		The ending parameters of the method call. You may use both numeric and non-numeric values, but the signature should match the start parameters
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   338
		 * @param	overwrite		Sets whether previous tweens for the same target and properties will be overwritten (Default is true)
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   339
		 * @return		The current actuator instance, which can be used to apply properties like ease, delay, onComplete or onUpdate
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   340
		 */
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   341
		public static function update (target:Function, duration:Number, start:Array = null, end:Array = null, overwrite:Boolean = true):GenericActuator {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   342
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   343
			var properties:Object = { start: start, end: end };
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   344
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   345
			return tween (target, duration, properties, overwrite, MethodActuator);
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   346
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   347
		}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   348
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   349
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   350
	}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   351
	
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   352
	
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   353
}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   354
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   355
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   356
import com.eclecticdesignstudio.motion.actuators.FilterActuator;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   357
import com.eclecticdesignstudio.motion.actuators.GenericActuator;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   358
import com.eclecticdesignstudio.motion.actuators.TransformActuator;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   359
import com.eclecticdesignstudio.motion.Actuate;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   360
import flash.display.DisplayObject;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   361
import flash.filters.BitmapFilter;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   362
import flash.filters.ColorMatrixFilter;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   363
import flash.geom.Matrix;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   364
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   365
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   366
class EffectsOptions {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   367
	
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   368
	
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   369
	protected var duration:Number;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   370
	protected var overwrite:Boolean;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   371
	protected var target:DisplayObject;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   372
	
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   373
	
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   374
	public function EffectsOptions (target:DisplayObject, duration:Number, overwrite:Boolean) {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   375
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   376
		this.target = target;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   377
		this.duration = duration;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   378
		this.overwrite = overwrite;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   379
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   380
	}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   381
	
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   382
	
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   383
	/**
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   384
	 * Creates a new BitmapFilter tween
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   385
	 * @param	reference		A reference to the target's filter, which can be an array index or the class of the filter
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   386
	 * @param	properties		The end properties to use for the tween
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   387
	 * @return		The current actuator instance, which can be used to apply properties like ease, delay, onComplete or onUpdate
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   388
	 */
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   389
	public function filter (reference:*, properties:Object):GenericActuator {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   390
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   391
		properties.filter = reference;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   392
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   393
		return Actuate.tween (target, duration, properties, overwrite, FilterActuator);
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   394
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   395
	}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   396
	
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   397
	
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   398
}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   399
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   400
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   401
class TransformOptions {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   402
	
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   403
	
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   404
	protected var duration:Number;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   405
	protected var overwrite:Boolean;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   406
	protected var target:Object;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   407
	
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   408
	
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   409
	public function TransformOptions (target:Object, duration:Number, overwrite:Boolean) {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   410
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   411
		this.target = target;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   412
		this.duration = duration;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   413
		this.overwrite = overwrite;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   414
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   415
	}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   416
	
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   417
	
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   418
	/**
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   419
	 * Creates a new ColorTransform tween
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   420
	 * @param	color		The color value
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   421
	 * @param	strength		The percentage amount of tint to apply (Default is 1)
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   422
	 * @param	alpha		The end alpha of the target. If you wish to tween alpha and tint simultaneously, you must do them both as part of the ColorTransform. A value of null will make no change to the alpha of the object (Default is null)
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   423
	 * @return		The current actuator instance, which can be used to apply properties like ease, delay, onComplete or onUpdate
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   424
	 */
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   425
	public function color (value:Number = 0x000000, strength:Number = 1, alpha:* = null):GenericActuator {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   426
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   427
		var properties:Object = { colorValue: value, colorStrength: strength };
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   428
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   429
		if (alpha is Number) {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   430
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   431
			properties.colorAlpha = alpha;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   432
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   433
		}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   434
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   435
		return Actuate.tween (target, duration, properties, overwrite, TransformActuator);
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   436
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   437
	}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   438
	
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   439
	
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   440
	/**
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   441
	 * Creates a new SoundTransform tween
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   442
	 * @param	volume		The end volume for the target, or null if you would like to ignore this property (Default is null)
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   443
	 * @param	pan		The end pan for the target, or null if you would like to ignore this property (Default is null)
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   444
	 * @return		The current actuator instance, which can be used to apply properties like ease, delay, onComplete or onUpdate
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   445
	 */
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   446
	public function sound (volume:* = null, pan:* = null):GenericActuator {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   447
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   448
		var properties:Object = new Object ();
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   449
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   450
		if (volume is Number) {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   451
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   452
			properties.soundVolume = volume;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   453
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   454
		}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   455
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   456
		if (pan is Number) {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   457
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   458
			properties.soundPan = pan;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   459
			
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   460
		}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   461
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   462
		return Actuate.tween (target, duration, properties, overwrite, TransformActuator);
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   463
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   464
	}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   465
	
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   466
	
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   467
}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   468
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   469
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   470
class TweenTimer {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   471
	
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   472
	
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   473
	public var progress:Number;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   474
	
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   475
	
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   476
	public function TweenTimer (progress:Number):void {
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   477
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   478
		this.progress = progress;
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   479
		
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   480
	}
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   481
	
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   482
	
6cab7e0b1678 flash : update recorder with size and tween.
cavaliet
parents:
diff changeset
   483
}