GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Description: the flash recorder for chirrp, written with haXe
Homepage: http://chirrp.net/
Clone URL: git://github.com/why/chirrup.git
Finished the basic flow of the recorder.
why (author)
Wed Apr 16 22:51:21 -0700 2008
commit  3f17013e47f9498f88a0750d4af450b523c0a5b0
tree    69083344b658d2381b32d4ac2dcf11e471cc3c55
parent  7998c464766522ec199f249ff4cd6b0e59669640
...
6
7
8
 
9
10
11
...
17
18
19
20
21
22
23
...
91
92
93
94
 
 
 
 
 
 
 
 
 
 
 
 
 
95
96
97
 
98
99
 
100
101
 
 
 
 
 
 
 
 
 
 
 
102
103
104
 
105
106
 
 
 
107
108
109
110
111
 
 
 
112
113
114
115
116
117
118
119
 
 
120
121
122
...
6
7
8
9
10
11
12
...
18
19
20
 
21
22
23
...
91
92
93
 
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
 
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
 
 
127
128
 
129
130
131
132
133
 
 
 
134
135
136
137
138
 
 
 
 
 
 
139
140
141
142
143
0
@@ -6,6 +6,7 @@ import flash.net.ObjectEncoding;
0
 import flash.system.Security;
0
 import flash.system.SecurityPanel;
0
 import flash.text.TextField;
0
+import flash.text.TextFormat;
0
 
0
 class Base {
0
 
0
@@ -17,7 +18,6 @@ class Base {
0
   static var mic : Microphone;
0
 
0
   static var httpExp : EReg = ~/^http:\/\//;
0
- static var bpos : Float = 2;
0
 
0
   static var DEGTORAD:Float = Math.PI/180;
0
   static var a:Float = Math.tan( 22.5 * DEGTORAD);
0
@@ -91,32 +91,53 @@ class Base {
0
     }
0
   }
0
 
0
- static function addButton( text, onClick ) {
0
+ static function addLink( text, onClick ) {
0
+ var f = new TextFormat();
0
+ f.font = "Verdana";
0
+ f.size = 12;
0
+ f.color = 0x5599AA;
0
+ f.underline = true;
0
+
0
+ var f2 = new TextFormat();
0
+ f2.font = "Verdana";
0
+ f2.size = 12;
0
+ f2.color = 0xAA9955;
0
+ f2.underline = true;
0
+
0
     var t = new TextField();
0
     t.text = text;
0
- t.width = t.textWidth + 6;
0
+ t.width = t.textWidth + 36;
0
     t.height = 18;
0
     t.selectable = false;
0
+ t.setTextFormat(f);
0
     t.x = 2;
0
 
0
+ var t2 = new TextField();
0
+ t2.text = text;
0
+ t2.width = t.textWidth + 36;
0
+ t2.height = 18;
0
+ t2.selectable = false;
0
+ t2.setTextFormat(f2);
0
+ t2.x = 2;
0
+
0
+ var a = new flash.display.MovieClip();
0
+ a.addChild(t);
0
+
0
     var b = new flash.display.MovieClip();
0
- b.graphics.beginFill(0xFFEEDD);
0
- b.graphics.lineStyle(2,0x000000);
0
+ b.graphics.beginFill(0);
0
     b.graphics.drawRect(0,0,t.width,18);
0
- b.addChild(t);
0
+
0
+ var c = new flash.display.MovieClip();
0
+ c.addChild(t2);
0
 
0
     var sb = new flash.display.SimpleButton();
0
- sb.upState = b;
0
- sb.overState = b;
0
- sb.downState = b;
0
+ sb.upState = a;
0
+ sb.overState = c;
0
+ sb.downState = c;
0
     sb.hitTestState = b;
0
     sb.useHandCursor = true;
0
- sb.addEventListener(flash.events.MouseEvent.CLICK, callback(doClick, onClick));
0
- flash.Lib.current.addChild(sb);
0
-
0
- sb.x = bpos;
0
- sb.y = 2;
0
- bpos += t.width + 5;
0
+ sb.addEventListener(flash.events.MouseEvent.CLICK, onClick);
0
+ return sb;
0
   }
0
 
0
   static function startConnect(host, func) {
...
8
9
10
11
 
12
13
14
...
17
18
19
20
 
21
22
...
8
9
10
 
11
12
13
14
...
17
18
19
 
20
21
22
0
@@ -8,7 +8,7 @@ class Play extends Base {
0
   static var file : String;
0
   static var re : EReg = ~/\/(\w+)\/(\w+)$/;
0
 
0
- static function playRecording() {
0
+ static function playRecording(e) {
0
     Base.play(Base.server + "/new.flv");
0
   }
0
 
0
@@ -17,6 +17,6 @@ class Play extends Base {
0
     file = flash.Lib.current.loaderInfo.parameters.file;
0
     if (file == null && re.match(url))
0
       file = re.matched(1) + re.matched(2);
0
- Base.addButton("Play", playRecording);
0
+ flash.Lib.current.addChild(Base.addLink("Play", playRecording));
0
   }
0
 }
0
...
19
20
21
22
 
 
23
24
25
...
46
47
48
49
50
51
52
...
57
58
59
60
61
62
63
 
 
 
 
 
 
 
 
 
 
64
65
66
67
68
69
 
 
70
71
72
...
141
142
143
144
 
145
146
147
148
 
149
150
151
152
153
 
154
155
156
 
157
158
159
160
161
162
163
 
164
165
166
 
 
167
168
169
170
171
172
173
174
175
176
177
178
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
180
...
19
20
21
 
22
23
24
25
26
...
47
48
49
 
50
51
52
...
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
...
151
152
153
 
154
155
156
157
 
158
159
160
161
162
 
163
164
165
 
166
167
168
169
170
171
172
 
173
174
 
 
175
176
177
178
179
180
 
 
 
 
 
 
 
 
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
0
@@ -19,7 +19,8 @@ class Rec extends Base {
0
   static var playButton : SimpleButton;
0
   static var countdown : TextField;
0
   static var countfont : TextFormat;
0
- static var stat : TextField;
0
+ static var countclip : MovieClip;
0
+ static var soundsgood : MovieClip;
0
 
0
   static var seconds : Float = 8;
0
 
0
@@ -46,7 +47,6 @@ class Rec extends Base {
0
   }
0
 
0
   static function startRecording(e) {
0
- stat.text = "Connecting...";
0
     stopButton.visible = true;
0
     recButton.visible = false;
0
     Base.record(uuid + ".flv", function(ns) {
0
@@ -57,16 +57,26 @@ class Rec extends Base {
0
   }
0
 
0
   static function playRecording(e) {
0
- stat.text = "Playing.";
0
     Base.play(uuid + ".flv");
0
   }
0
 
0
+ static function reRecord(e) {
0
+ recButton.visible = true;
0
+ stopButton.visible = false;
0
+ playButton.visible = false;
0
+ countdown.text = "8";
0
+ countdown.setTextFormat(countfont);
0
+ countclip.visible = true;
0
+ soundsgood.visible = false;
0
+ }
0
+
0
   static function stopRecording(e) {
0
- stat.text = "Stopped";
0
     Base.stop();
0
     clock.stop();
0
     stopButton.visible = false;
0
     playButton.visible = true;
0
+ countclip.visible = false;
0
+ soundsgood.visible = true;
0
   }
0
 
0
   static function main() {
0
@@ -141,40 +151,61 @@ class Rec extends Base {
0
     mcmed.bold = true;
0
     mcmed.color = 0;
0
 
0
- var mcc = new MovieClip();
0
+ countclip = new MovieClip();
0
     var mct = new TextField();
0
     mct.text = "You have";
0
     mct.setTextFormat(mcmed);
0
- mcc.addChild(mct);
0
+ countclip.addChild(mct);
0
 
0
     countdown = new TextField();
0
     countdown.text = "8";
0
     countdown.setTextFormat(countfont);
0
- mcc.addChild(countdown);
0
+ countclip.addChild(countdown);
0
     countdown.x = 10;
0
     countdown.y = 4;
0
- flash.Lib.current.addChild(mcc);
0
+ flash.Lib.current.addChild(countclip);
0
 
0
     var mct2 = new TextField();
0
     mct2.text = "seconds";
0
     mct2.setTextFormat(mcmed);
0
     mct2.x = 3;
0
     mct2.y = 72;
0
- mcc.addChild(mct2);
0
+ countclip.addChild(mct2);
0
 
0
- mcc.x = 220;
0
- mcc.y = 20;
0
+ countclip.x = 220;
0
+ countclip.y = 20;
0
 
0
     //
0
     // Sounds good?
0
     //
0
- stat = new TextField();
0
- stat.text = "Stopped.";
0
- stat.width = 380;
0
- stat.height = 18;
0
- stat.selectable = false;
0
- stat.x = 2;
0
- stat.y = 124;
0
- flash.Lib.current.addChild(stat);
0
+ var med = new TextFormat();
0
+ med.font = "Verdana";
0
+ med.size = 25;
0
+ med.bold = true;
0
+ med.color = 0;
0
+
0
+ var soundstxt = new TextField();
0
+ soundstxt.text = "Sounds good?";
0
+ soundstxt.width = 250;
0
+ soundstxt.height = 50;
0
+ soundstxt.setTextFormat(med);
0
+
0
+ var okLink = Base.addLink("OK, make it tweet!", function(e) {});
0
+ var noLink = Base.addLink("Nah, record it again.", reRecord);
0
+
0
+ soundsgood = new MovieClip();
0
+ soundsgood.addChild(soundstxt);
0
+ soundsgood.addChild(okLink);
0
+ soundsgood.addChild(noLink);
0
+
0
+ okLink.x = 30;
0
+ okLink.y = 40;
0
+ noLink.x = 20;
0
+ noLink.y = 62;
0
+
0
+ flash.Lib.current.addChild(soundsgood);
0
+ soundsgood.visible = false;
0
+ soundsgood.x = 170;
0
+ soundsgood.y = 20;
0
   }
0
 }
...
8
9
10
11
 
12
...
8
9
10
 
11
12
0
@@ -8,5 +8,5 @@
0
 
0
 -swf chirplay.swf
0
 -swf-version 9
0
--swf-header 400:140:24:FFFFFF
0
+-swf-header 400:40:24:FFFFFF
0
 -main Play

Comments

    No one has commented yet.