0 Replies Latest reply on Apr 1, 2010 6:23 PM by marcanthonyphoto1221

    Flash Experts. Solve this! (Duplicate Post)

    marcanthonyphoto1221

      I have an actionscript 2.0 for Flash to record a webcam stream and copy it locally to my Flash Media Server. No big deal there. It is exactly what I need. Now here is the problem. recordBTN is a movie clip  in my library that controls the start and the stop of the recording. It's just one movieclip. On frame 1 there is a label marked startRec (Hence the code in the actionscript below). When you click startRec it begins recording the stream and the movie clip goes to frame 10 marked stopRec (Again, hence the code in the actionscript). The movie doesn't stop recording automatically however. The button just changes the text from Start Recording to Stop Recording. Here's the question. What EXACTLY do I do to add a countdown timer so people can see how much time they have left and have this recording stop automatically once the countdown clock reaches 0 in case they don't hit the stop recording? Below is the actionscript. The correct winner will get an iPad. Not really. But you will get a big thanks from me because I am stumped.

       

      import flash.external.*;

       

      /*    =================================
          Audio
          ================================= */
      var mic:Microphone = Microphone.get();
      var sound:Sound = new Sound();
      var isRecording:Boolean = false;
      recordBtn.onRelease = function():Void {
          if( isRecording ) { // stop recording
              sound.setVolume( 100 );
              this.gotoAndStop( "startRec" );
              publish_ns.close();
              publish_ns.attachAudio( null );   
              publish_ns = null;
              publish_ns = new NetStream( nc );
              publish_ns.attachVideo( Camera.get() );
             
          } else { // start recording
              this.gotoAndStop( "stopRec" );
              publish_ns.publish( getUniqueStreamName(), "append" );
              publish_ns.attachAudio( mic );
              sound.setVolume( 0 );
          }
          isRecording = !isRecording;
      }