title: How to play a short beep in Actionscript?
body: <p>I can play a beep sound like this:</p>
  
  <pre><code>private var beep:Sound = new Sound();
  
  private function beepInit():void {
      var beepHandler:Function = new Function();
  
          beepHandler = function(event:SampleDataEvent):void {
              for (var i:uint = 0; i &lt; 2048; i++) {
                  var wavePos:Number = 20 * Math.PI * i / 2048;
                  event.data.writeFloat(Math.sin(wavePos));
                  event.data.writeFloat(Math.sin(wavePos));
              }
          }
  
          beep.addEventListener(SampleDataEvent.SAMPLE_DATA, beepHandler);
  }
  </code></pre>
  
  <p>At application start I call beepInit();</p>
  
  <p>To play, call: beep.play();</p>
  
  <p>This is continuous sound. How can I make it to ex. 500 ms. short beep?</p>