0
import flash.display.BitmapData;
0
+import flash.display.MovieClip;
0
+import flash.display.SimpleButton;
0
import flash.net.NetStream;
0
import flash.text.TextField;
0
+import flash.text.TextFormat;
0
-class ShoesPng extends BitmapData {
0
+class RecOffPng extends BitmapData {}
0
+class RecOnPng extends BitmapData {}
0
+class RecHoverPng extends BitmapData {}
0
+class PlayUpPng extends BitmapData {}
0
+class PlayDownPng extends BitmapData {}
0
class Rec extends Base {
0
+ static var recButton : SimpleButton;
0
+ static var stopButton : SimpleButton;
0
+ static var playButton : SimpleButton;
0
+ static var countdown : TextField;
0
+ static var countfont : TextFormat;
0
+ static var stat : TextField;
0
static var seconds : Float = 8;
0
+ static var uuid : String;
0
static var url : String;
0
- static var stat : TextField;
0
static var clock : Timer;
0
static var start : Float = 0;
0
static function timeRecording() {
0
- stat.text = "" + Base.elapsedTime();
0
if (Base.elapsedTime() > 0) {
0
used = (Timer.stamp() - start);
0
- stat.text = "" + used;
0
+ countdown.text = "" + Std.int(seconds - used);
0
+ countdown.setTextFormat(countfont);
0
- static function startRecording(
) {
0
+ static function startRecording(
e) {
0
stat.text = "Connecting...";
0
- Base.record("new.flv", function(ns) {
0
+ stopButton.visible = true;
0
+ recButton.visible = false;
0
+ Base.record(uuid + ".flv", function(ns) {
0
clock = new Timer(200);
0
clock.run = timeRecording;
0
- static function playRecording(
) {
0
+ static function playRecording(
e) {
0
stat.text = "Playing.";
0
+ Base.play(
uuid + ".flv");
0
- static function stopRecording(
) {
0
+ static function stopRecording(
e) {
0
+ stopButton.visible = false;
0
+ playButton.visible = true;
0
static function main() {
0
- var png1 : BitmapData = new ShoesPng(0, 0);
0
- flash.Lib.current.addChild(new flash.display.Bitmap(png1, flash.display.PixelSnapping.AUTO, true));
0
+ uuid = Base.random(32);
0
+ var rec_off = new RecOffPng(0, 0);
0
+ var rec_hit = new MovieClip();
0
+ rec_hit.graphics.beginFill(0);
0
+ Base.drawCircle(rec_hit, 54, 54, 36);
0
+ new RecHoverPng(0, 0),
0
+ var stop_on = new RecOnPng(0, 0);
0
+ stopButton.visible = false;
0
+ var play_up = new PlayUpPng(0, 0);
0
+ var play_down = new PlayDownPng(0, 0);
0
+ playButton.visible = false;
0
+ // Countdown instrument
0
+ countfont = new TextFormat();
0
+ countfont.font = "Verdana";
0
+ countfont.bold = true;
0
+ var mcmed = new TextFormat();
0
+ mcmed.font = "Verdana";
0
+ var mcc = new MovieClip();
0
+ var mct = new TextField();
0
+ mct.text = "You have";
0
+ mct.setTextFormat(mcmed);
0
+ countdown = new TextField();
0
+ countdown.setTextFormat(countfont);
0
+ mcc.addChild(countdown);
0
+ flash.Lib.current.addChild(mcc);
0
- url = flash.Lib.current.loaderInfo.loaderURL;
0
+ var mct2 = new TextField();
0
+ mct2.text = "seconds";
0
+ mct2.setTextFormat(mcmed);
0
- Base.addButton("Start", startRecording);
0
- Base.addButton("Stop", stopRecording);
0
- Base.addButton("Play", playRecording);
0
stat = new TextField();
0
stat.text = "Stopped.";
0
stat.selectable = false;
0
flash.Lib.current.addChild(stat);
Comments
No one has commented yet.