• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Actionscript 3.0 Download progress bar for streaming audio not working

Guest
Jun 24, 2012 Jun 24, 2012

Copy link to clipboard

Copied

This is my first ever post here. 

The bad script is below.  The movie has 1 frame.  When simulating a download, (DSL speed, 3MB .mp3) nothing displays on the stage until the entire .mp3 has completed downloading.

At this point all the trace statement outputs (1%, 2,3...100%)  rapidly appear in the Output panel, (if I use an event progress COMPLETED handler it traces out loaded at this point) ,

the graphics then appear on stage and the progress bar is set at 100% and the sound starts playing.

It looks like it downloads the .mp3, suspending other processing as it does but queues up the progress event outputs, then rushes through all the Progress Events outputs in 1 burst,

reports load completed (if a handler is included for this), displays graphics and then plays audio. It is not streaming.

I want to see the progress bar gradually climb up to 100% with text updates as it plays streaming.

I have tried using other events such as a Timer or Enter Frame. No go. Nothing displays until the .mp3 has completely downloaded.

Is this a known AS 3.0 bug?  I have found nothing on the web about this issue.

I have lost all my hair on this one.  (Note: Actionscript two version works fine.)

A guru will solve this.

stop();

var theSound:Sound= new Sound();

theSound.load(new URLRequest("c2.mp3"));

var channel:SoundChannel;

channel=theSound.play();

theSound.addEventListener(ProgressEvent.PROGRESS, showStreaming);

function showStreaming(event: ProgressEvent):void {

    var loaded:Number=event.bytesLoaded;

    var total:Number=event.bytesTotal;

    var loadPercent:Number=Math.round(loaded/total*100);

    trace(loadPercent);

    progressBar_mc.scaleX=loadPercent/100;

    percent_txt.text="Downloaded "+loadPercent+"%";

} //showStreaming;

TOPICS
ActionScript

Views

1.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 25, 2012 Jun 25, 2012

Copy link to clipboard

Copied

Here's a good discussion: http://www.gotoandlearnforum.com/viewtopic.php?f=29&t=15581

Look at the example code that's about 8 replies down.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 25, 2012 Jun 25, 2012

Copy link to clipboard

Copied

That seems to just use a soundcontext which sets a download buffer size before it plays.

I've mucked around with that and doesn't seem to help. Thanks anyway.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 27, 2012 Jun 27, 2012

Copy link to clipboard

Copied

LATEST

Still waiting for a solution. No gurus here.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines