My favorites | Sign in
Project Logo
                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
package com.hydrotik.go {
import org.goasap.interfaces.IPlayable;
import org.goasap.managers.LinearGoRepeater;
import org.goasap.utils.SequenceCA;
import org.goasap.utils.SequenceStepCA;
import org.goasap.utils.customadvance.OnPlayableComplete;
import org.goasap.utils.customadvance.SequenceAdvance;

/**
* @author Donovan Adams | Hydrotik | http://blog.hydrotik.com
*/
public class HydroSequence extends SequenceCA {

public static const VERSION:String = "HydroTween 0.5.1e rev43 / Go 0.5.1e";

public static const INFO:String = VERSION + " (c) Donovan Adams/Moses Gunesch/Tollman Owens, MIT Licensed.";

//private var sequence : SequenceCA = new SequenceCA();

public function HydroSequence(...actions) {
super(actions);
addArrayItem(actions);
}

public function addItem(...actions) : void
{
addArrayItem(actions);
}

public function addArrayItem(actions:Array):void{
for (var i:int = 0; i<actions.length; i++) {
if (actions[i] is IPlayable) {
addStep(actions[i]); // gil -- we can now mix SequenceStepCA's and IPlayable's in with our sequence
} else {
var step:SequenceStepCA = new SequenceStepCA();
var group:Array = (actions[i] is Array ? actions[i] : [ actions[i] ]);
for each (var action:Object in group) {
//if (action.hasOwnProperty("target")==false) { continue; } //left this in so you can see the changes. delete at will!
var targArray:Array = (action.target is Array ? action.target as Array : [action.target]);
for each (var targ:Object in targArray) {
var tween: IPlayable = parseAction(targ, action);
step.addChild(tween);
if (action.hasOwnProperty("advance")) {
var advance: SequenceAdvance = (action["advance"] as SequenceAdvance);
if (advance) {
if (advance is OnPlayableComplete) {
if ((advance as OnPlayableComplete).item==null) (advance as OnPlayableComplete).item = tween;
}
step.advance = advance;
}
}
}
}
addStep(step); //sequence.addStep(step); // gil
}
}
}


override public function start():Boolean
{
return super.start(); // gil // return sequence.start()
}

private static function parseAction(target:Object, action:Object):IPlayable{
var tween : *;
if(action['target'] != null){
var pTo:Object = {};

tween = new HydroTween(target,null,NaN,NaN,null,null,null,null,null,null,
(action.hasOwnProperty("repeater") && action.repeater is LinearGoRepeater ? action.repeater : null));
for (var prop:String in action) {
if (prop=="advance" || action[prop] is LinearGoRepeater)
continue;
if (tween.hasOwnProperty(prop)) // delay, duration, etc.
tween[prop] = action[prop];
else if (prop == "scope") // delay, duration, etc.
tween.setScope(action[prop]);
else if (prop == "updater") // delay, duration, etc.
tween.setUpdate(action[prop]);
else if (prop == "updaterArgs") // delay, duration, etc.
tween.setUpdateArgs(action[prop]);
else if (prop == "func") // delay, duration, etc.
tween.setClosure(action[prop]);
else if (prop == "args") // delay, duration, etc.
tween.setClosureArgs(action[prop]);
else
pTo[prop] = action[prop];
}
tween.setProps(pTo);
}else{
tween = new HydroTween(new Object, {}, 0, (action['delay'] == null) ? 0 : action['delay'] , null, action['func'], action['updater'], action['args'], action['updaterArgs']);
}

return tween;
}

}
}
Show details Hide details

Change log

r251 by gilbuns on May 11, 2009   Diff
Now allow any IPlayable in addItem()
instead of just SequenceStepCA
Go to: 
Project members, sign in to write a code review

Older revisions

r250 by gilbuns on May 05, 2009   Diff
Several Fixes to HydroSequence.as now
allow you to add SequenceStepCA
objects to your sequences, and use
HydroSequence class just like you
would use the SequenceCA class.
r241 by dono...@hydrotik.com on Sep 21, 2008   Diff
rev43: Converted color tweening from
ColorMatrix to ColorTransform. Fixed
bug with disposing for proper Garbage
Collection. Added static var for
disabling GC with AUTOGC. Changed
...
r240 by dono...@hydrotik.com on Aug 17, 2008   Diff
Color Hex tweening bug fixed. Removed
tint prop temporarily for fixing and
proper functionality.
All revisions of this file

File info

Size: 3574 bytes, 99 lines

File properties

svn:eol-style
native
svn:executable
*
Hosted by Google Code