michaelforrest-tidy 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1,62 @@
1
+ package com.lbi.animation.util {
2
+ import com.lbi.animation.single.OrphanEvent;
3
+ import flash.events.EventDispatcher;
4
+ import flash.events.IEventDispatcher;
5
+
6
+ import com.lbi.animation.single.MethodWithCompleteEvent;
7
+ import com.lbi.animation.util.IAnimation;
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 GroupCommon extends EventDispatcher {
27
+ protected var items:/*IAnimation*/ Array;
28
+ private var label:String = "";
29
+ public function GroupCommon(...$items) {
30
+ items = new Array();
31
+ //TODO: make the initialization work (I don't really get these ... arguments yet.. sorry - MF)
32
+ /*
33
+ for(var i:Number=0; i<$items.length; i++){
34
+ var item : Animation = $items[i];
35
+ if(item != null) addAnimation(item);
36
+ }*/
37
+ }
38
+ /**
39
+ * The only requirement is that the object:IEvent dispatches an event
40
+ * named in complete_event when it's finished its thang
41
+ * If you set complete_event to null or undefined, then the method is called synchronously.
42
+ * @param - the object executing the method
43
+ * @param - a delegate for the method to execute
44
+ */
45
+ public function addMethod(object : IEventDispatcher, method:Function, complete_event:String , ...args) : void {
46
+ var new_method : MethodWithCompleteEvent = new MethodWithCompleteEvent(object,method,complete_event,args);
47
+ addItem(new_method);
48
+ }
49
+ protected function addItem(animation : IAnimation) : void {
50
+ items.push(animation);
51
+ }
52
+ public function addAnimation(animation:IAnimation) : void {
53
+ addItem(animation);
54
+ }
55
+ public function addLabel(l:String) : void {
56
+ this.label = l;
57
+ }
58
+ public function waitForEvent(object : IEventDispatcher, event : String) : void {
59
+ addItem(new OrphanEvent(object, event));
60
+ }
61
+ }
62
+ }
@@ -0,0 +1,30 @@
1
+ package com.lbi.animation.util {
2
+ import flash.events.IEventDispatcher;
3
+
4
+ /**
5
+ LBi Useful ActionScript 3 Library
6
+ Copyright (C) 2007 LBi / Michael Forrest
7
+
8
+ This library is free software; you can redistribute it and/or
9
+ modify it under the terms of the GNU Lesser General Public
10
+ License as published by the Free Software Foundation; either
11
+ version 2.1 of the License, or (at your option) any later version.
12
+
13
+ This library is distributed in the hope that it will be useful,
14
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ Lesser General Public License for more details.
17
+
18
+ You should have received a copy of the GNU Lesser General Public
19
+ License along with this library; if not, write to the Free Software
20
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
+ * IAnimation is used for any class that you can tell go() and dispatches "complete" when it has finished doing whatever it was doing
22
+ */
23
+ [Event("complete")]
24
+ public interface IAnimation extends IEventDispatcher {
25
+ function go() : void;
26
+ function destroy() : void;
27
+ function stop(dispatchComplete:Boolean = false) : void;
28
+ function isComplete():Boolean;
29
+ }
30
+ }
@@ -0,0 +1,96 @@
1
+ package com.lbi.debug {
2
+ import flash.display.Sprite;
3
+ import flash.events.Event;
4
+ import flash.events.KeyboardEvent;
5
+ import flash.events.MouseEvent;
6
+ import flash.ui.Keyboard;
7
+ /**
8
+ * @author michaelforrest
9
+ */
10
+ public class DraggyClip {
11
+ public static function initialize(sprite : Sprite) : void {
12
+
13
+ sprite.mouseChildren = false;
14
+ sprite.addEventListener(MouseEvent.MOUSE_DOWN,onMouseDown,false,0,true);
15
+ sprite.addEventListener(MouseEvent.MOUSE_UP, onMouseUp,false,0,true) ;
16
+ sprite.addEventListener(MouseEvent.ROLL_OVER, addKeyListener,false,0,true);
17
+ sprite.addEventListener(MouseEvent.ROLL_OUT, removeKeyListener,false,0,true);
18
+
19
+ }
20
+ public static function addKeyListener(event:Event):void {
21
+ var sprite : Sprite = event.target as Sprite;
22
+ sprite.addEventListener(KeyboardEvent.KEY_DOWN, _onKeyPress);
23
+
24
+ sprite.alpha = 50;
25
+ //SimpleDrawing.outline( sprite, 0xFF0000);
26
+ }
27
+ public static function removeKeyListener(event:Event):void{
28
+ var sprite : Sprite = event.target as Sprite;
29
+ //sprite.graphics.clear();
30
+ sprite.removeEventListener(KeyboardEvent.KEY_DOWN, _onKeyPress);
31
+ }
32
+ public static function onMouseDown(event:MouseEvent):void{
33
+ var sprite : Sprite = event.target as Sprite;
34
+ if(!sprite) throw new Error(event.target + " was not a sprite ");
35
+ sprite.startDrag();
36
+ }
37
+ public static function onMouseUp(event:MouseEvent):void{
38
+ var sprite : Sprite = event.target as Sprite;
39
+ sprite.stopDrag();
40
+ trace("released ", sprite, " at ", sprite.x+","+sprite.y);
41
+ }
42
+ public static function _onKeyPress(event:KeyboardEvent):void{
43
+ var sprite : Sprite = event.target as Sprite;
44
+ var key_ascii : Number = event.keyCode;
45
+
46
+ trace("pressed ", key_ascii);
47
+
48
+ // = (equals) key
49
+ if(key_ascii==0x3D){
50
+ sprite.scaleX = sprite.scaleY = sprite.scaleX + 5;
51
+ }
52
+ // - (minus) key
53
+ if(key_ascii==0x2d){
54
+ sprite.scaleX = sprite.scaleY = sprite.scaleX - 5;
55
+ }
56
+ // _ (shift + minus) key
57
+ if(key_ascii==0x2b){
58
+ sprite.scaleX = sprite.scaleY = sprite.scaleX + .5;
59
+ }
60
+ // + (shift + plus) key
61
+ if(key_ascii==0x5F){
62
+ sprite.scaleX = sprite.scaleY = sprite.scaleX - .5;
63
+ }
64
+ // p ("print") key
65
+ if(key_ascii==0x70){
66
+ trace("Point(" + Math.round(sprite.x) + ", " + Math.round(sprite.y) +"), scale=" + sprite.scaleX + "("+ sprite + ")");
67
+ }
68
+ // t ("transparent") key
69
+ if(key_ascii==0x74){
70
+ sprite.alpha = 50;
71
+ }
72
+ // T ("untransparent") key
73
+ if(key_ascii==0x54){
74
+ sprite.alpha = 100;
75
+ }
76
+ var increment:Number = 1;
77
+ if(event.ctrlKey){
78
+ increment = 10;
79
+ }
80
+ if(key_ascii == Keyboard.LEFT) {
81
+
82
+ sprite.x -= increment;
83
+ }
84
+ if(key_ascii == Keyboard.RIGHT) {
85
+ sprite.x += increment;
86
+ }
87
+ if(key_ascii == Keyboard.UP){
88
+ sprite.y -= increment;
89
+ }
90
+ if(key_ascii == Keyboard.DOWN){
91
+ sprite.y += increment;
92
+ }
93
+
94
+ }
95
+ }
96
+ }
@@ -0,0 +1,48 @@
1
+ package com.lbi.debug {
2
+ import com.lbi.mvc.helper.TypographyBase;
3
+ import com.lbi.mvc.view.ViewBase;
4
+
5
+ import flash.events.Event;
6
+ import flash.geom.Rectangle;
7
+ import flash.text.TextField;
8
+ import flash.utils.getTimer;
9
+
10
+ /**
11
+ * @author michaelforrest
12
+ * (based on http://kaioa.com/node/83)
13
+ */
14
+ public class FPSView extends ViewBase {
15
+ private var last : uint = getTimer();
16
+ private var ticks : uint = 0;
17
+ private var label : TextField;
18
+
19
+ public function FPSView() {
20
+ super();
21
+ addEventListener(Event.ADDED_TO_STAGE, onAddedToStage,false,0,true);
22
+ }
23
+
24
+ private function onAddedToStage(event : Event) : void {
25
+ trace("made fps view");
26
+ var style : TypographyBase = new TypographyBase();
27
+ style.embed_fonts = false;
28
+ style.font = "_sans";
29
+ style.align = "right";
30
+ columnWidth = stage.stageWidth;
31
+ label = addTextField(style, new Rectangle(0,0,100,30));
32
+
33
+ addEventListener(Event.ENTER_FRAME, onEnterFrame,false,0,true);
34
+ }
35
+
36
+ private function onEnterFrame(event : Event) : void {
37
+ ticks++;
38
+ var now : uint = getTimer();
39
+ var delta : uint = now - last;
40
+ if (delta >= 500) {
41
+ var fps : Number = ticks / delta * 1000;
42
+ label.text = fps.toFixed(1) + " fps";
43
+ ticks = 0;
44
+ last = now;
45
+ }
46
+ }
47
+ }
48
+ }
@@ -0,0 +1,60 @@
1
+ package com.lbi.debug {
2
+ import flash.display.Stage;
3
+ import flash.events.Event;
4
+ import flash.events.EventDispatcher;
5
+ import flash.events.KeyboardEvent;
6
+ /**
7
+ * @author michaelforrest
8
+ */
9
+ public class KeySequenceTrigger extends EventDispatcher {
10
+ private var trigger : String;
11
+
12
+ private var next_character_index : Number = 0;
13
+ private static var stage : Stage;
14
+ public static const TRIGGERED : String = "triggered";
15
+
16
+ function KeySequenceTrigger($trigger : String) {
17
+ super();
18
+ if(!stage) throw new Error("Sorry - you need to initialise KeySequenceTrigger in your app so that it can listen to the stage. Do this in AppView after it has been instantiated");
19
+ trigger = $trigger;
20
+ stage.addEventListener(KeyboardEvent.KEY_UP,onKeyUp,false,0,true);
21
+
22
+ }
23
+
24
+ private function onKeyUp(e : KeyboardEvent) : void {
25
+ if(e.charCode==getNextCharacterCode()){
26
+ if(isLastCharacter()){
27
+ dispatchEvent(new Event(TRIGGERED));
28
+ reset();
29
+ }
30
+ }
31
+ else{
32
+ reset();
33
+ }
34
+ }
35
+ private function getNextCharacterCode() : Number {
36
+ var c:Number = trigger.charCodeAt(next_character_index);
37
+ next_character_index++;
38
+ return c;
39
+ }
40
+
41
+ private function isLastCharacter() : Boolean {
42
+ return next_character_index >= trigger.length;
43
+ }
44
+
45
+ private function reset() : void {
46
+ next_character_index = 0;
47
+ }
48
+
49
+ public static function init($stage : Stage) : void {
50
+ stage = $stage;
51
+ }
52
+
53
+ public static function makeTriggers(triggers : Array) : void {
54
+ for (var i : Number = 0; i < triggers.length; i++) {
55
+ var trigger:Object = triggers[i];
56
+ new KeySequenceTrigger(trigger.trigger).addEventListener(TRIGGERED, trigger.action,false,0,true);
57
+ }
58
+ }
59
+ }
60
+ }
@@ -0,0 +1,168 @@
1
+ package com.lbi.debug {
2
+ import com.lbi.debug.LogItemType;
3
+ /**
4
+ * @author chrgio
5
+ */
6
+ public class Log
7
+ {
8
+ // these are set in the logger as well
9
+ private static const DEFAULT_BACKGROUND : Number = 0xFFFFFF;
10
+ private static const DEFAULT_FOREGROUND : Number = 0x000000;
11
+
12
+ private static var DEFAULT_LEVEL : Number = 5;
13
+ private static var log_level : Number;
14
+
15
+ public static function setLogLevel( level : Number ) : void
16
+ {
17
+ log_level = level;
18
+ }
19
+
20
+ public static function getLogLevel() : Number
21
+ {
22
+ // if(isNaN(log_level)){
23
+ // // In this first iteration I wasn't able to get the parameter from the html :S
24
+ // var app : Object = Application.application;
25
+ // var level : Number;
26
+ // if(app != null) level = app["parameters"]["log_level"] as Number;
27
+ // log_level = (!isNaN(level) ? level : DEFAULT_LEVEL);
28
+ // }
29
+ return log_level;
30
+ }
31
+
32
+ private static var items : Array;
33
+ private static var last_message : String;
34
+ private static var last_message_type : LogType;
35
+
36
+ public static function debug(message : String) : void
37
+ {
38
+ output(LogType.DEBUG, message);
39
+ }
40
+
41
+ public static function info(message : String) : void
42
+ {
43
+ output(LogType.INFO, message);
44
+ }
45
+
46
+ public static function warn(message : String) : void
47
+ {
48
+ output(LogType.WARNING, message);
49
+ }
50
+
51
+ public static function error(message : String) : void
52
+ {
53
+ output(LogType.ERROR, message);
54
+ }
55
+
56
+ public static function fatal(message : String) : void
57
+ {
58
+ output(LogType.FATAL, message);
59
+ }
60
+
61
+ private static function output(type : LogType, message : String) : void
62
+ {
63
+ if(getLogLevel() < type.level) return;
64
+ last_message_type = type;
65
+ last_message = message;
66
+ trace("[" + type + "] " + message);
67
+ }
68
+
69
+ public static function getLastMessage() : String
70
+ {
71
+ return last_message;
72
+ }
73
+
74
+ public static function getLastMessageType() : LogType
75
+ {
76
+ return last_message_type;
77
+ }
78
+
79
+ public static function clear() : void
80
+ {
81
+ last_message = null;
82
+ last_message_type = null;
83
+ }
84
+
85
+ public static function custom( message : String, foreground_colour : Number = DEFAULT_FOREGROUND, background_colour : Number = DEFAULT_BACKGROUND, bold : Boolean = false, level : Number = 0 ) : void
86
+ {
87
+ if(getLogLevel() < level) return;
88
+ var command : String = "[custom";
89
+ if(foreground_colour != DEFAULT_FOREGROUND) command += " foreground=#" + foreground_colour.toString(16);
90
+ if(background_colour != DEFAULT_BACKGROUND) command += " background=#" + background_colour.toString(16);
91
+ if(bold == true) command += " bold=true";
92
+ command += "] " + message;
93
+
94
+ last_message_type = LogType.CUSTOM;
95
+ last_message = command;
96
+
97
+ trace(command);
98
+ }
99
+
100
+ public static function createGroup(id : String, foreground_colour : Number = DEFAULT_FOREGROUND, background_colour : Number = DEFAULT_BACKGROUND, bold : Boolean = false, level : Number = 0) : void
101
+ {
102
+ createItemCommand(LogItemType.GROUP, id, foreground_colour, background_colour, bold, level);
103
+ }
104
+
105
+ public static function group( id : String, message : String ) : void
106
+ {
107
+ item(LogItemType.GROUP, id, message);
108
+ }
109
+
110
+ public static function createElement(id : String, foreground_colour : Number = DEFAULT_FOREGROUND, background_colour : Number = DEFAULT_BACKGROUND, bold : Boolean = false, level : Number = 0) : void
111
+ {
112
+ createItemCommand(LogItemType.ELEMENT, id, foreground_colour, background_colour, bold, level);
113
+ }
114
+
115
+ public static function element( id : String, message : String ) : void
116
+ {
117
+ item(LogItemType.ELEMENT, id, message);
118
+ }
119
+
120
+ private static function createItemCommand(type : LogItemType, id : String, foreground_colour : Number, background_colour : Number, bold : Boolean, level : Number = 0 ) : void
121
+ {
122
+ if(id.split(" ").length > 1) {
123
+ error("Log::createItemCommand, id shouldn't contain empty spaces");
124
+ return;
125
+ }
126
+ var command : String = "[setup-" + type + " " + id;
127
+ if(foreground_colour != DEFAULT_FOREGROUND) command += " foreground=#" + getHex(foreground_colour);
128
+ if(background_colour != DEFAULT_BACKGROUND) command += " background=#" + getHex(background_colour);
129
+ if(bold == true) command += " bold=true";
130
+ command += "]";
131
+
132
+ registerItem(type, id, level);
133
+
134
+ last_message_type = LogType.CUSTOM;
135
+ last_message = command;
136
+
137
+ trace(command);
138
+ }
139
+
140
+ private static function registerItem(type : LogItemType, id : String, level : Number) : void
141
+ {
142
+ if(items == null) items = [];
143
+ items[getItemId(type, id)] = level;
144
+ }
145
+
146
+ private static function getHex( colour : Number ) : String
147
+ {
148
+ var hex : String = colour.toString(16);
149
+ for (var i : Number = hex.length;i < 6; i++) hex = "0" + hex;
150
+ return hex;
151
+ }
152
+
153
+ private static function item(type : LogItemType, id : String, message : String) : void
154
+ {
155
+ var item_level : Number = items[getItemId(type, id)] || 0;
156
+ if(getLogLevel() < item_level) return;
157
+
158
+ last_message_type = LogType.CUSTOM;
159
+ last_message = "[" + type + " " + id + "] " + message;
160
+ trace(last_message);
161
+ }
162
+
163
+ private static function getItemId( type : LogItemType, id : String ) : String
164
+ {
165
+ return type + "-" + id;
166
+ }
167
+ }
168
+ }
@@ -0,0 +1,23 @@
1
+ package com.lbi.debug
2
+ {
3
+ /**
4
+ * @author chrgio
5
+ */
6
+ public class LogItemType
7
+ {
8
+ public static var GROUP : LogItemType = new LogItemType("group");
9
+ public static var ELEMENT : LogItemType = new LogItemType("element");
10
+
11
+ private var value : String;
12
+
13
+ function LogItemType(value : String)
14
+ {
15
+ this.value = value;
16
+ }
17
+
18
+ public function toString () : String
19
+ {
20
+ return this.value;
21
+ }
22
+ }
23
+ }
@@ -0,0 +1,31 @@
1
+ package com.lbi.debug
2
+ {
3
+ /**
4
+ * @author chrgio
5
+ */
6
+ public class LogType
7
+ {
8
+ public static var FATAL : LogType = new LogType("fatal", 0);
9
+ public static var ERROR : LogType = new LogType("error", 1);
10
+ public static var WARNING : LogType = new LogType("warning", 2);
11
+ public static var INFO : LogType = new LogType("info", 3);
12
+ public static var DEBUG : LogType = new LogType("debug", 4);
13
+
14
+ public static var CUSTOM : LogType = new LogType("custom", 0);
15
+
16
+ public var level : Number;
17
+ private var value : String;
18
+
19
+
20
+ function LogType(value : String, level : Number)
21
+ {
22
+ this.value = value.toUpperCase();
23
+ this.level = level;
24
+ }
25
+
26
+ public function toString () : String
27
+ {
28
+ return value;
29
+ }
30
+ }
31
+ }
@@ -0,0 +1,24 @@
1
+ package com.lbi.debug {
2
+ import flash.display.DisplayObject;
3
+ import flash.display.DisplayObjectContainer;
4
+ /**
5
+ * @author michaelforrest
6
+ */
7
+ public class ViewAnalysis {
8
+ public static function allViewsInside(top : DisplayObjectContainer) : String {
9
+ var result : String = "";
10
+ result += childrenOf(top);
11
+ return result;
12
+ }
13
+
14
+ private static function childrenOf(top : DisplayObjectContainer, tabs : String = "") : String {
15
+ var result : String = "";
16
+ result += ("\n" + tabs + top.toString());
17
+ for (var i : Number = 0; i < top.numChildren; i++) {
18
+ var item : DisplayObject = top.getChildAt(i);
19
+ result += ("\n" + tabs + childrenOf(item as DisplayObjectContainer, tabs + "\t"));
20
+ }
21
+ return result;
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,16 @@
1
+ package com.lbi.media {
2
+ import flash.media.SoundLoaderContext;
3
+ import flash.net.URLRequest;
4
+ /**
5
+ * @author michaelforrest
6
+ */
7
+ public interface IBufferable {
8
+ function get bytesLoaded() : uint;
9
+
10
+ function get bytesTotal() : int;
11
+
12
+ function get isBuffering() : Boolean;
13
+
14
+ function load(stream : URLRequest, context : SoundLoaderContext = null) : void;
15
+ }
16
+ }
@@ -0,0 +1,11 @@
1
+ package com.lbi.media {
2
+ import flash.media.SoundChannel;
3
+ import flash.media.SoundTransform;
4
+ /**
5
+ * @author michaelforrest
6
+ */
7
+ public interface ITransportControllable {
8
+ function play(startTime : Number = 0, loops : int = 0, sndTransform : SoundTransform = null) : SoundChannel;
9
+ function pause() : void;
10
+ }
11
+ }