michaelforrest-tidy 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. data/Manifest +87 -0
  2. data/README +5 -0
  3. data/Rakefile +14 -0
  4. data/bin/tidyproject +33 -0
  5. data/lib/aslibs/as3/lbi/com/lbi/animation/animator/Animator.as +86 -0
  6. data/lib/aslibs/as3/lbi/com/lbi/animation/animator/Transition.as +142 -0
  7. data/lib/aslibs/as3/lbi/com/lbi/animation/group/Parallel.as +28 -0
  8. data/lib/aslibs/as3/lbi/com/lbi/animation/group/Queue.as +93 -0
  9. data/lib/aslibs/as3/lbi/com/lbi/animation/group/Sequence.as +28 -0
  10. data/lib/aslibs/as3/lbi/com/lbi/animation/group/Set.as +82 -0
  11. data/lib/aslibs/as3/lbi/com/lbi/animation/group/Stack.as +30 -0
  12. data/lib/aslibs/as3/lbi/com/lbi/animation/single/Animation.as +173 -0
  13. data/lib/aslibs/as3/lbi/com/lbi/animation/single/Message.as +36 -0
  14. data/lib/aslibs/as3/lbi/com/lbi/animation/single/MethodWithCompleteEvent.as +75 -0
  15. data/lib/aslibs/as3/lbi/com/lbi/animation/single/OrphanEvent.as +78 -0
  16. data/lib/aslibs/as3/lbi/com/lbi/animation/single/Pause.as +35 -0
  17. data/lib/aslibs/as3/lbi/com/lbi/animation/single/Tween.as +73 -0
  18. data/lib/aslibs/as3/lbi/com/lbi/animation/util/Easing.as +158 -0
  19. data/lib/aslibs/as3/lbi/com/lbi/animation/util/Engine.as +35 -0
  20. data/lib/aslibs/as3/lbi/com/lbi/animation/util/GroupCommon.as +62 -0
  21. data/lib/aslibs/as3/lbi/com/lbi/animation/util/IAnimation.as +30 -0
  22. data/lib/aslibs/as3/lbi/com/lbi/debug/DraggyClip.as +96 -0
  23. data/lib/aslibs/as3/lbi/com/lbi/debug/FPSView.as +48 -0
  24. data/lib/aslibs/as3/lbi/com/lbi/debug/KeySequenceTrigger.as +60 -0
  25. data/lib/aslibs/as3/lbi/com/lbi/debug/Log.as +168 -0
  26. data/lib/aslibs/as3/lbi/com/lbi/debug/LogItemType.as +23 -0
  27. data/lib/aslibs/as3/lbi/com/lbi/debug/LogType.as +31 -0
  28. data/lib/aslibs/as3/lbi/com/lbi/debug/ViewAnalysis.as +24 -0
  29. data/lib/aslibs/as3/lbi/com/lbi/media/IBufferable.as +16 -0
  30. data/lib/aslibs/as3/lbi/com/lbi/media/ITransportControllable.as +11 -0
  31. data/lib/aslibs/as3/lbi/com/lbi/mvc/collection/Collection.as +296 -0
  32. data/lib/aslibs/as3/lbi/com/lbi/mvc/collection/ISearchable.as +10 -0
  33. data/lib/aslibs/as3/lbi/com/lbi/mvc/collection/ISelectable.as +10 -0
  34. data/lib/aslibs/as3/lbi/com/lbi/mvc/collection/Matchable.as +9 -0
  35. data/lib/aslibs/as3/lbi/com/lbi/mvc/collection/Searchable.as +56 -0
  36. data/lib/aslibs/as3/lbi/com/lbi/mvc/collection/Selectable.as +49 -0
  37. data/lib/aslibs/as3/lbi/com/lbi/mvc/helper/Cloner.as +15 -0
  38. data/lib/aslibs/as3/lbi/com/lbi/mvc/helper/TypographyBase.as +194 -0
  39. data/lib/aslibs/as3/lbi/com/lbi/mvc/helper/preloading/LoadProgressEvent.as +18 -0
  40. data/lib/aslibs/as3/lbi/com/lbi/mvc/model/Application.as +45 -0
  41. data/lib/aslibs/as3/lbi/com/lbi/mvc/model/ConcurrentDependencyLoader.as +27 -0
  42. data/lib/aslibs/as3/lbi/com/lbi/mvc/model/EventMapper.as +85 -0
  43. data/lib/aslibs/as3/lbi/com/lbi/mvc/model/Hyperlink.as +36 -0
  44. data/lib/aslibs/as3/lbi/com/lbi/mvc/model/IEventMapper.as +10 -0
  45. data/lib/aslibs/as3/lbi/com/lbi/mvc/model/Merge.as +14 -0
  46. data/lib/aslibs/as3/lbi/com/lbi/mvc/model/SequentialDependencyLoader.as +43 -0
  47. data/lib/aslibs/as3/lbi/com/lbi/mvc/model/StringFormatting.as +142 -0
  48. data/lib/aslibs/as3/lbi/com/lbi/mvc/model/XMLListLoader.as +98 -0
  49. data/lib/aslibs/as3/lbi/com/lbi/mvc/model/XMLListLoaderDispatcher.as +52 -0
  50. data/lib/aslibs/as3/lbi/com/lbi/mvc/view/ViewBase.as +323 -0
  51. data/lib/aslibs/as3/lbi/com/quasimondo/geom/ColorMatrix.as +682 -0
  52. data/lib/script/as2/lib/as2_class.rb +37 -0
  53. data/lib/script/as2/lib/test/SampleClass.as +34 -0
  54. data/lib/script/as2/lib/test/as2_class_test.rb +15 -0
  55. data/lib/script/as2/navigation/bin/xml/__model.xml +7 -0
  56. data/lib/script/as2/navigation/navigation.rb +44 -0
  57. data/lib/script/as2/navigation/src/app/models/App.as +14 -0
  58. data/lib/script/as2/navigation/src/app/models/__Model.as +42 -0
  59. data/lib/script/as2/navigation/src/app/views/__model/__ModelView.as +61 -0
  60. data/lib/script/as2/navigation/src/app/views/__model/__ModelsView.as +33 -0
  61. data/lib/script/as2/project/project.rb +7 -0
  62. data/lib/script/as2/project/src/app/helpers/Colours.as +1 -0
  63. data/lib/script/as2/project/src/app/helpers/Typography.as +1 -0
  64. data/lib/script/as2/project/src/app/models/App.as +22 -0
  65. data/lib/script/as2/project/src/app/models/FlashVars.as +1 -0
  66. data/lib/script/as2/project/src/app/models/Linkages.as +8 -0
  67. data/lib/script/as2/project/src/app/views/AppView.as +21 -0
  68. data/lib/script/as3/project/project.rb +10 -0
  69. data/lib/script/as3/project/src/app/helpers/Colours.as +1 -0
  70. data/lib/script/as3/project/src/app/helpers/Typography.as +1 -0
  71. data/lib/script/as3/project/src/app/models/App.as +21 -0
  72. data/lib/script/as3/project/src/app/models/FlashVars.as +1 -0
  73. data/lib/script/as3/project/src/app/views/AppView.as +27 -0
  74. data/lib/script/as3/scaffold/bin/xml/__model.xml +0 -0
  75. data/lib/script/as3/scaffold/scaffold.rb +41 -0
  76. data/lib/script/as3/scaffold/src/models/__Model.as +11 -0
  77. data/lib/script/as3/scaffold/src/views/__model/__ModelDetailView.as +0 -0
  78. data/lib/script/as3/scaffold/src/views/__model/__ModelListItemView.as +0 -0
  79. data/lib/script/as3/scaffold/src/views/__model/__ModelListView.as +0 -0
  80. data/lib/script/bwlimit.rb +305 -0
  81. data/lib/script/generate +117 -0
  82. data/lib/script/server +4 -0
  83. data/lib/script/server.rb +20 -0
  84. data/lib/tidy_project.rb +19 -0
  85. data/tasks/build.rake +4 -0
  86. data/tasks/release.rake +8 -0
  87. data/test/test_tidy_project.rb +22 -0
  88. data/tidy.gemspec +33 -0
  89. metadata +229 -0
data/Manifest ADDED
@@ -0,0 +1,87 @@
1
+ bin/tidyproject
2
+ lib/aslibs/as3/lbi/com/lbi/animation/animator/Animator.as
3
+ lib/aslibs/as3/lbi/com/lbi/animation/animator/Transition.as
4
+ lib/aslibs/as3/lbi/com/lbi/animation/group/Parallel.as
5
+ lib/aslibs/as3/lbi/com/lbi/animation/group/Queue.as
6
+ lib/aslibs/as3/lbi/com/lbi/animation/group/Sequence.as
7
+ lib/aslibs/as3/lbi/com/lbi/animation/group/Set.as
8
+ lib/aslibs/as3/lbi/com/lbi/animation/group/Stack.as
9
+ lib/aslibs/as3/lbi/com/lbi/animation/single/Animation.as
10
+ lib/aslibs/as3/lbi/com/lbi/animation/single/Message.as
11
+ lib/aslibs/as3/lbi/com/lbi/animation/single/MethodWithCompleteEvent.as
12
+ lib/aslibs/as3/lbi/com/lbi/animation/single/OrphanEvent.as
13
+ lib/aslibs/as3/lbi/com/lbi/animation/single/Pause.as
14
+ lib/aslibs/as3/lbi/com/lbi/animation/single/Tween.as
15
+ lib/aslibs/as3/lbi/com/lbi/animation/util/Easing.as
16
+ lib/aslibs/as3/lbi/com/lbi/animation/util/Engine.as
17
+ lib/aslibs/as3/lbi/com/lbi/animation/util/GroupCommon.as
18
+ lib/aslibs/as3/lbi/com/lbi/animation/util/IAnimation.as
19
+ lib/aslibs/as3/lbi/com/lbi/debug/DraggyClip.as
20
+ lib/aslibs/as3/lbi/com/lbi/debug/FPSView.as
21
+ lib/aslibs/as3/lbi/com/lbi/debug/KeySequenceTrigger.as
22
+ lib/aslibs/as3/lbi/com/lbi/debug/Log.as
23
+ lib/aslibs/as3/lbi/com/lbi/debug/LogItemType.as
24
+ lib/aslibs/as3/lbi/com/lbi/debug/LogType.as
25
+ lib/aslibs/as3/lbi/com/lbi/debug/ViewAnalysis.as
26
+ lib/aslibs/as3/lbi/com/lbi/media/IBufferable.as
27
+ lib/aslibs/as3/lbi/com/lbi/media/ITransportControllable.as
28
+ lib/aslibs/as3/lbi/com/lbi/mvc/collection/Collection.as
29
+ lib/aslibs/as3/lbi/com/lbi/mvc/collection/ISearchable.as
30
+ lib/aslibs/as3/lbi/com/lbi/mvc/collection/ISelectable.as
31
+ lib/aslibs/as3/lbi/com/lbi/mvc/collection/Matchable.as
32
+ lib/aslibs/as3/lbi/com/lbi/mvc/collection/Searchable.as
33
+ lib/aslibs/as3/lbi/com/lbi/mvc/collection/Selectable.as
34
+ lib/aslibs/as3/lbi/com/lbi/mvc/helper/Cloner.as
35
+ lib/aslibs/as3/lbi/com/lbi/mvc/helper/preloading/LoadProgressEvent.as
36
+ lib/aslibs/as3/lbi/com/lbi/mvc/helper/TypographyBase.as
37
+ lib/aslibs/as3/lbi/com/lbi/mvc/model/Application.as
38
+ lib/aslibs/as3/lbi/com/lbi/mvc/model/ConcurrentDependencyLoader.as
39
+ lib/aslibs/as3/lbi/com/lbi/mvc/model/EventMapper.as
40
+ lib/aslibs/as3/lbi/com/lbi/mvc/model/Hyperlink.as
41
+ lib/aslibs/as3/lbi/com/lbi/mvc/model/IEventMapper.as
42
+ lib/aslibs/as3/lbi/com/lbi/mvc/model/Merge.as
43
+ lib/aslibs/as3/lbi/com/lbi/mvc/model/SequentialDependencyLoader.as
44
+ lib/aslibs/as3/lbi/com/lbi/mvc/model/StringFormatting.as
45
+ lib/aslibs/as3/lbi/com/lbi/mvc/model/XMLListLoader.as
46
+ lib/aslibs/as3/lbi/com/lbi/mvc/model/XMLListLoaderDispatcher.as
47
+ lib/aslibs/as3/lbi/com/lbi/mvc/view/ViewBase.as
48
+ lib/aslibs/as3/lbi/com/quasimondo/geom/ColorMatrix.as
49
+ lib/script/as2/lib/as2_class.rb
50
+ lib/script/as2/lib/test/as2_class_test.rb
51
+ lib/script/as2/lib/test/SampleClass.as
52
+ lib/script/as2/navigation/bin/xml/__model.xml
53
+ lib/script/as2/navigation/navigation.rb
54
+ lib/script/as2/navigation/src/app/models/__Model.as
55
+ lib/script/as2/navigation/src/app/models/App.as
56
+ lib/script/as2/navigation/src/app/views/__model/__ModelsView.as
57
+ lib/script/as2/navigation/src/app/views/__model/__ModelView.as
58
+ lib/script/as2/project/project.rb
59
+ lib/script/as2/project/src/app/helpers/Colours.as
60
+ lib/script/as2/project/src/app/helpers/Typography.as
61
+ lib/script/as2/project/src/app/models/App.as
62
+ lib/script/as2/project/src/app/models/FlashVars.as
63
+ lib/script/as2/project/src/app/models/Linkages.as
64
+ lib/script/as2/project/src/app/views/AppView.as
65
+ lib/script/as3/project/project.rb
66
+ lib/script/as3/project/src/app/helpers/Colours.as
67
+ lib/script/as3/project/src/app/helpers/Typography.as
68
+ lib/script/as3/project/src/app/models/App.as
69
+ lib/script/as3/project/src/app/models/FlashVars.as
70
+ lib/script/as3/project/src/app/views/AppView.as
71
+ lib/script/as3/scaffold/bin/xml/__model.xml
72
+ lib/script/as3/scaffold/scaffold.rb
73
+ lib/script/as3/scaffold/src/models/__Model.as
74
+ lib/script/as3/scaffold/src/views/__model/__ModelDetailView.as
75
+ lib/script/as3/scaffold/src/views/__model/__ModelListItemView.as
76
+ lib/script/as3/scaffold/src/views/__model/__ModelListView.as
77
+ lib/script/bwlimit.rb
78
+ lib/script/generate
79
+ lib/script/server
80
+ lib/script/server.rb
81
+ lib/tidy_project.rb
82
+ Manifest
83
+ Rakefile
84
+ README
85
+ tasks/build.rake
86
+ tasks/release.rake
87
+ test/test
data/README ADDED
@@ -0,0 +1,5 @@
1
+ All this does is copies my libraries into a Sprouts project folder.
2
+
3
+ USAGE:
4
+
5
+ tidyproject SomeProject
data/Rakefile ADDED
@@ -0,0 +1,14 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'echoe'
4
+
5
+ Echoe.new('tidy', '0.1.1') do |p|
6
+ p.description = "Tidy Flash - an ActionScript framework for people who love Ruby"
7
+ p.url = "http://github.com/michaelforrest/tidy"
8
+ p.author = "Michael Forrest"
9
+ p.email = "mf@grimaceworks.com"
10
+ p.ignore_pattern = ["tmp/**/*", "script/*"]
11
+ p.development_dependencies = [ ]
12
+ end
13
+
14
+ Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
data/bin/tidyproject ADDED
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ require 'rubygems'
4
+ require 'optparse'
5
+ require File.dirname(__FILE__) + '/../lib/tidy_project'
6
+
7
+ def fail_with(opts, message)
8
+ puts "[ERROR] #{message}"
9
+ puts ""
10
+ puts opts
11
+ exit
12
+ end
13
+
14
+ parser = OptionParser.new do |options|
15
+ options.banner = <<-BANNER
16
+ Tidy is an ActionScript framework for people who love Ruby
17
+
18
+ Usage: #{File.basename($0)}
19
+ - adds necessary stuff to project
20
+ BANNER
21
+
22
+ options.separator ""
23
+
24
+ # options.on("-v", "--verbose", "Show what it's doing") do
25
+ # OPTIONS[:verbose] = true
26
+ # end
27
+
28
+
29
+ end
30
+
31
+ puts ">> adding stuff to project"
32
+ fail_with ARGV, "Please specify a project name!" if ARGV.length < 1
33
+ TidyProject.new(ARGV[0])
@@ -0,0 +1,86 @@
1
+ package com.lbi.animation.animator {
2
+ import flash.utils.Proxy;
3
+ import flash.utils.flash_proxy;
4
+
5
+ import com.lbi.animation.animator.Transition;
6
+ import com.lbi.mvc.collection.Searchable;
7
+ /**
8
+ LBi Useful ActionScript 3 Library
9
+ Copyright (C) 2007 LBi / Michael Forrest
10
+
11
+ This library is free software; you can redistribute it and/or
12
+ modify it under the terms of the GNU Lesser General Public
13
+ License as published by the Free Software Foundation; either
14
+ version 2.1 of the License, or (at your option) any later version.
15
+
16
+ This library is distributed in the hope that it will be useful,
17
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19
+ Lesser General Public License for more details.
20
+
21
+ You should have received a copy of the GNU Lesser General Public
22
+ License along with this library; if not, write to the Free Software
23
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24
+ */
25
+ dynamic public class Animator extends Proxy{
26
+ private var object : Object;
27
+ private var transitions : Searchable;
28
+ private var defaultFrames : Number = Transition.DEFAULT_FRAMES;
29
+ private var defaultEasing : Function = Transition.DEFAULT_EASING;
30
+
31
+ public function Animator($object : Object) {
32
+ object = $object;
33
+ transitions = new Searchable([]);
34
+ }
35
+
36
+ public function setDefaultFrames(n : Number) : void{
37
+ defaultFrames = n;
38
+ }
39
+ public function setDefaultEasing(f : Function) : void{
40
+ defaultEasing = f;
41
+ }
42
+ private function registerTransition($property : String) : Transition {
43
+ var transition : Transition = new Transition(object,$property);
44
+ transition.setFrames(defaultFrames);
45
+ transition.setEasing(defaultEasing);
46
+ transitions.push(transition);
47
+ return transition;
48
+ }
49
+
50
+ override flash_proxy function getProperty(name:*):* {
51
+ return object[name];
52
+ }
53
+ // called when setting dynamic variables
54
+ override flash_proxy function setProperty(name:*, value:*):void {
55
+ var transition : Transition = getTransitionByProperty(name);
56
+ if(!transition) transition = registerTransition(name);
57
+ transition.trigger(value as Number);
58
+ }
59
+ public function change($property:String):Transition{
60
+ return getTransitionByProperty($property);
61
+ }
62
+
63
+ private function getTransitionByProperty($property : String) : Transition {
64
+ return transitions.findByProperty("property", $property) as Transition || registerTransition($property);
65
+ }
66
+ public function isAnimating(property : String) : Boolean{
67
+ var t : Transition= getTransitionByProperty(property);
68
+ if(!t) return false;
69
+ return t.isInProgress();
70
+ }
71
+ public function listen(property:String, callback:Function, threshold : Number = 1):void{
72
+ if(threshold == 1){
73
+ change(property).addEventListener(Transition.COMPLETE, callback,false,0,true);
74
+ }else{
75
+ change(property).listenForThreshold(threshold, callback);
76
+ }
77
+ }
78
+ public function unlisten(property:String,callback:Function) : void{
79
+ change(property).removeEventListener(Transition.COMPLETE, callback);
80
+ }
81
+ public function wait(frames:Number):void{
82
+ trace("wait not implemented")
83
+ }
84
+
85
+ }
86
+ }
@@ -0,0 +1,142 @@
1
+ package com.lbi.animation.animator {
2
+ import flash.events.Event;
3
+ import flash.events.EventDispatcher;
4
+ import flash.utils.getQualifiedClassName;
5
+ import flash.utils.getTimer;
6
+
7
+ import com.lbi.animation.single.Animation;
8
+ import com.lbi.animation.util.Easing;
9
+ import com.lbi.debug.Log;
10
+ /**
11
+ LBi Useful ActionScript 3 Library
12
+ Copyright (C) 2007 LBi / Michael Forrest
13
+
14
+ This library is free software; you can redistribute it and/or
15
+ modify it under the terms of the GNU Lesser General Public
16
+ License as published by the Free Software Foundation; either
17
+ version 2.1 of the License, or (at your option) any later version.
18
+
19
+ This library is distributed in the hope that it will be useful,
20
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
21
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22
+ Lesser General Public License for more details.
23
+
24
+ You should have received a copy of the GNU Lesser General Public
25
+ License along with this library; if not, write to the Free Software
26
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27
+
28
+ */
29
+ public class Transition extends EventDispatcher {
30
+ public static var COMPLETE : String = "complete";
31
+ private function dispatchComplete(e:Event):void {
32
+ animation = null;
33
+ dispatchEvent(new Event(COMPLETE));
34
+ }
35
+
36
+ public static var DEFAULT_FRAMES : Number = 10;
37
+ public static var DEFAULT_EASING : Function = Easing.easeOutCubic;
38
+
39
+ // These are the properties that you can change:
40
+ public var frames : Number = DEFAULT_FRAMES;
41
+ public var easing : Function;
42
+ // end of properties you can change.
43
+
44
+ public var property : String;
45
+ private var object : Object;
46
+ private var animation : Animation;
47
+ private var cache : Number;
48
+
49
+ private var start : Number;
50
+ private var id : String;
51
+ private var threshold : Number = -1;
52
+ private static const THRESHOLD_CROSSED : String = "threshold_crossed";
53
+ private var end : Number;
54
+
55
+ public function Transition($object: Object, $property : String) {
56
+ id = getTimer().toString();
57
+ easing = DEFAULT_EASING;
58
+ object = $object;
59
+ property = $property;
60
+ cache = object[property];
61
+ if(isNaN(cache)) Log.warn("Please set a default value for " + getQualifiedClassName($object) + "." + $property);
62
+ }
63
+
64
+ override public function addEventListener(type : String, listener : Function, useCapture : Boolean = false, priority : int = 0, useWeakReference : Boolean = false) : void {
65
+ removeEventListener(type, listener); // make sure it can only be done once. I think..
66
+ super.addEventListener(type, listener, useCapture, priority, true);
67
+ }
68
+
69
+ public function trigger($target : Number) : void {
70
+ interrupt();
71
+ start = getCurrentValue();
72
+ end = $target;
73
+ // Log.debug("setting " + this + " end point to " + end );
74
+ animation = new Animation(animate, 0, 1, frames);
75
+ cache = object[property];
76
+ animation.addEventListener("complete", dispatchComplete,false,0,true);
77
+ animation.go();
78
+ }
79
+ public function interrupt() : void {
80
+ if(animation) {
81
+ animation.destroy();
82
+ animation = null;
83
+ }
84
+ }
85
+
86
+ private function animate(next:Number, prev:Number) : void {
87
+ if(getCurrentValue()!=cache){
88
+ interrupt();
89
+ }else{
90
+ try {
91
+ var v : Number = interpolate(easing(next));
92
+ object[property] = v;
93
+ if(threshold > -1 && v >= threshold){
94
+ threshold = -1;
95
+ dispatchEvent(new Event(THRESHOLD_CROSSED));
96
+ }
97
+ }catch(e:Error){
98
+ Log.error("Error in animate" + e.toString());
99
+ }
100
+ }
101
+ cache = getCurrentValue();
102
+ }
103
+
104
+ public function getProperty() : String {
105
+ return property;
106
+ }
107
+
108
+ private function getCurrentValue() : Number {
109
+ return object[property];
110
+ }
111
+
112
+ private function interpolate(pos : Number) : Number {
113
+ return pos * (end-start) + start;
114
+ }
115
+ /**
116
+ * returns this Transition so that settings can be chained.
117
+ */
118
+ public function setFrames($frames:Number) : Transition{
119
+ frames = $frames;
120
+ return this;
121
+ }
122
+ /**
123
+ * returns this Transition so that settings can be chained
124
+ */
125
+ public function setEasing($function:Function) :Transition{
126
+ easing = $function;
127
+ return this;
128
+ }
129
+ override public function toString() : String{
130
+ return "[Transition "+ id + "]";
131
+ }
132
+
133
+ public function listenForThreshold(threshold : Number, callback : Function) : void {
134
+ this.threshold = threshold;
135
+ addEventListener(THRESHOLD_CROSSED, callback, false, 0, true);
136
+ }
137
+
138
+ public function isInProgress() : Boolean {
139
+ return !(animation == null);
140
+ }
141
+ }
142
+ }
@@ -0,0 +1,28 @@
1
+ package com.lbi.animation.group {
2
+ import com.lbi.animation.group.Set;
3
+ /**
4
+ LBi Useful ActionScript 3 Library
5
+ Copyright (C) 2007 LBi / Michael Forrest
6
+
7
+ This library is free software; you can redistribute it and/or
8
+ modify it under the terms of the GNU Lesser General Public
9
+ License as published by the Free Software Foundation; either
10
+ version 2.1 of the License, or (at your option) any later version.
11
+
12
+ This library is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
+ Lesser General Public License for more details.
16
+
17
+ You should have received a copy of the GNU Lesser General Public
18
+ License along with this library; if not, write to the Free Software
19
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
+
21
+ * ALIAS for Set
22
+ */
23
+ public class Parallel extends Set {
24
+ public function Parallel($items : Array) {
25
+ super($items);
26
+ }
27
+ }
28
+ }
@@ -0,0 +1,93 @@
1
+ package com.lbi.animation.group {
2
+ import flash.events.Event;
3
+
4
+ import com.lbi.animation.single.Message;
5
+ import com.lbi.animation.util.GroupCommon;
6
+ import com.lbi.animation.util.IAnimation;
7
+
8
+ [Event("complete")]
9
+ /**
10
+ LBi Useful ActionScript 3 Library
11
+ Copyright (C) 2007 LBi / Michael Forrest
12
+
13
+ This library is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU Lesser General Public
15
+ License as published by the Free Software Foundation; either
16
+ version 2.1 of the License, or (at your option) any later version.
17
+
18
+ This library is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21
+ Lesser General Public License for more details.
22
+
23
+ You should have received a copy of the GNU Lesser General Public
24
+ License along with this library; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26
+ */
27
+ public class Queue extends GroupCommon implements IAnimation {
28
+
29
+ private var current_item:Number = 0;
30
+ private var is_complete:Boolean = false;
31
+
32
+ /**
33
+ * @param $items is optional
34
+ */
35
+ function Queue(...$items){
36
+ super($items);
37
+ items = new Array();
38
+ }
39
+
40
+ public function go() : void {
41
+ is_complete = false;
42
+ playItem(current_item);
43
+ }
44
+
45
+ private function playItem(item_id:Number) : void {
46
+ var item:IAnimation = items[item_id];
47
+ //item.setCompleteDelegate(complete_delegate);
48
+ item.addEventListener("complete", playNextItem,false,0,true);
49
+ item.go();
50
+ }
51
+
52
+ private function playNextItem(e:Event) : void {
53
+ var item:IAnimation = items[current_item];
54
+ current_item++;
55
+ if(current_item < items.length){
56
+ playItem(current_item);
57
+ }
58
+ else{
59
+ dispatchCompleteEvent();
60
+ }
61
+ }
62
+ public function stop(dispatchComplete:Boolean = false) : void {
63
+ IAnimation(items[current_item]).stop();
64
+ current_item = 0;
65
+ if(dispatchComplete) dispatchCompleteEvent();
66
+ }
67
+ private function dispatchCompleteEvent() : void {
68
+ is_complete = true;
69
+ current_item = 0;
70
+ dispatchEvent(new Event("complete"));
71
+ }
72
+
73
+ public function isComplete():Boolean{
74
+ return is_complete;
75
+ }
76
+ public function getType():String {
77
+ return "queue";
78
+ }
79
+ public function destroy() : void {
80
+ for(var i:String in items){
81
+ var item:IAnimation = items[i];
82
+ //item.removeEventListener("complete" , item.getCompleteDelegate());
83
+ item.destroy();
84
+ }
85
+ delete this;
86
+ }
87
+ public function addMessage(message : String) : void {
88
+ var m:Message = new Message(message);
89
+ addItem(m);
90
+ }
91
+
92
+ }
93
+ }
@@ -0,0 +1,28 @@
1
+ package com.lbi.animation.group {
2
+ import com.lbi.animation.group.Queue;
3
+ /**
4
+ LBi Useful ActionScript 3 Library
5
+ Copyright (C) 2007 LBi / Michael Forrest
6
+
7
+ This library is free software; you can redistribute it and/or
8
+ modify it under the terms of the GNU Lesser General Public
9
+ License as published by the Free Software Foundation; either
10
+ version 2.1 of the License, or (at your option) any later version.
11
+
12
+ This library is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
+ Lesser General Public License for more details.
16
+
17
+ You should have received a copy of the GNU Lesser General Public
18
+ License along with this library; if not, write to the Free Software
19
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
+
21
+ * ALIAS for Queue
22
+ */
23
+ public class Sequence extends Queue {
24
+ public function Sequence(...$items) {
25
+ super($items);
26
+ }
27
+ }
28
+ }
@@ -0,0 +1,82 @@
1
+ package com.lbi.animation.group {
2
+ import com.lbi.animation.util.GroupCommon;
3
+ import com.lbi.animation.util.IAnimation;
4
+
5
+ import flash.events.Event;
6
+
7
+ [Event("complete")]
8
+ /**
9
+ LBi Useful ActionScript 3 Library
10
+ Copyright (C) 2007 LBi / Michael Forrest
11
+
12
+ This library is free software; you can redistribute it and/or
13
+ modify it under the terms of the GNU Lesser General Public
14
+ License as published by the Free Software Foundation; either
15
+ version 2.1 of the License, or (at your option) any later version.
16
+
17
+ This library is distributed in the hope that it will be useful,
18
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20
+ Lesser General Public License for more details.
21
+
22
+ You should have received a copy of the GNU Lesser General Public
23
+ License along with this library; if not, write to the Free Software
24
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25
+ */
26
+ public class Set extends GroupCommon implements IAnimation {
27
+ /**
28
+ * Use addAnimation or addQueue to populate the stack
29
+ */
30
+ function Set(...$items){
31
+ super($items);
32
+ }
33
+
34
+ public function stop(dispatchComplete:Boolean = false) : void {
35
+ for(var i:String in items){
36
+ var item:IAnimation = items[i];
37
+ item.stop();
38
+ }
39
+ if(dispatchComplete) dispatchEvent(new Event("complete"));
40
+ }
41
+ public function go() : void {
42
+ for (var i:Number=0; i<items.length; i++) {
43
+ var item : IAnimation = items[i];
44
+ item.addEventListener("complete", countFinishedAnims,false,0,true);
45
+ item.go();
46
+ }
47
+ }
48
+ public function isComplete():Boolean{
49
+ return countItemsRemaining()==0;
50
+ }
51
+ private function countItemsRemaining():Number{
52
+ var remaining:Number = 0;
53
+ for(var i:Number=0;i<items.length; i++){
54
+ var item:IAnimation = items[i];
55
+ if(!item.isComplete()) remaining++;
56
+ }
57
+ return remaining;
58
+ }
59
+ private function countFinishedAnims(e:Event) : void {
60
+ IAnimation(e.target).removeEventListener("complete",countFinishedAnims);
61
+
62
+ var done:Boolean = true;
63
+ for(var i:String in items){
64
+ var item:IAnimation = items[i];
65
+ if(!item.isComplete()) done=false;
66
+ }
67
+ if (done) {
68
+ dispatchEvent(new Event("complete"));
69
+ destroy();
70
+ }
71
+ }
72
+
73
+ public function destroy() : void {
74
+ for(var i:String in items){
75
+ var s:IAnimation = items[i];
76
+ s.destroy();
77
+ }
78
+ delete this;
79
+ }
80
+ }
81
+
82
+ }
@@ -0,0 +1,30 @@
1
+ package com.lbi.animation.group {
2
+ import com.lbi.animation.group.Set;
3
+ /**
4
+ LBi Useful ActionScript 3 Library
5
+ Copyright (C) 2007 LBi / Michael Forrest
6
+
7
+ This library is free software; you can redistribute it and/or
8
+ modify it under the terms of the GNU Lesser General Public
9
+ License as published by the Free Software Foundation; either
10
+ version 2.1 of the License, or (at your option) any later version.
11
+
12
+ This library is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
+ Lesser General Public License for more details.
16
+
17
+ You should have received a copy of the GNU Lesser General Public
18
+ License along with this library; if not, write to the Free Software
19
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
+
21
+ * DEPRECATED! This is an alias for Set.
22
+ */
23
+ public class Stack extends Set {
24
+ public function Stack(...$items ) {
25
+ super($items);
26
+ }
27
+
28
+
29
+ }
30
+ }