...

View Full Version : Stop a streaming sound



bigtiger
05-10-2009, 01:53 PM
Currently, I used the sound object to build a simple MP3 Player.
It worked without any issues that it could play, advance, etc.

When the stop button was pressed. The downloading of MP3 was still continue.

These are the commands that I have used to stop downloading and playing sound files, Sound.stop and stopAllSounds.
But, it seems that these commands could not stop downloading of sound files.


Any help are appreciate.

Eric,

Attachment:
7378

gnomeontherun
05-11-2009, 09:49 AM
The sound object only controls the playing, not the loading. To stop it loading will also remove it from Flash, I believe. I can't be 100%, but you would just need to clear the loading process.

bigtiger
05-11-2009, 02:55 PM
I apologize that I have not specify it correctly for my flash version used, it is flash 8.0.

I have used some styles like these,



var song:Sound = new Sound(this);

...

song = null;
song = undefined;
delete song;


but none of them would work .

I also found that Flash CS3 or later had a method called close() on Sound Object from ActionScript 3.0 reference that could close the stream.
(I found that by google and I'am just lucky :))

Am I right that it seems that there are not possible to do that with flash 8.0.
Because it will be waste network bandwidth when someone change the song list as mulitiple songs are downloaded simultaneously.


Eric,

Thanks,

gnomeontherun
05-11-2009, 04:07 PM
If you reuse the stream (song in your case) then it should replace with the new stream and stop loading the old. Check the function list for sounds in actionscript (I would but its not loading right now) and look at whats there.

bigtiger
05-13-2009, 04:38 PM
That seems did't work also.

I was used these simple statements,


// frame1
var index:Number = 0;
var player:Sound = new Sound(this);
var songlist:Array = ['song1.mp3', 'song2.mp3', 'song3.mp3'];

// button1
on(release)
{
_parent.player.loadSound(songlist[++index], true);
}


Thanks,

Eric,



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum