Groups | Blog | Home
all groups > flash actionscript > december 2005 >

flash actionscript : streaming with Sound() class


Motion Maker
12/11/2005 1:37:53 PM
The example in Flash 8 is a good model:

this.createTextField("status_txt", this.getNextHighestDepth(), 0,0,100,22);

// create a new Sound object
var my_sound:Sound = new Sound();
// if the sound loads, play it; if not, trace failure loading
my_sound.onLoad = function(success:Boolean) {
if (success) {
my_sound.start();
status_txt.text = "Sound loaded";
} else {
status_txt.text = "Sound failed";
}
};
// load the sound
my_sound.loadSound("song1.mp3", true);

The second argument in loadSound creates the streaming functionality.

However this streaming does not mean sync as does the one in the frame
properties window. It means the sound will play as soon as possible.

You can control the sound to make it stop, play and so on if you like and
requirement I like to give college students in my advanced multimedia
courses.



--
Lon Hosford
www.lonhosford.com
May many happy bits flow your way!
[quoted text, click to view]
Hi eveybody,
I'm searching for a way to create streaming with the Sound class of
Actionscript.
As in :

http://www.estvideo.com/dew/index/2005/02/16/370-player-flash-mp3-leger-comme-un
e-plume
in wich you can see that the MP3 is displayed before it's completely
loaded.
I've tried to launch start() method before the MP3 is totally loaded but
nothing happen.
If someone can help me, even if it's a tiny advice,
Thanks a lot,
Sylvain,
(Sorry for my english).

Motion Maker
12/11/2005 3:39:48 PM
[quoted text, click to view]

Correct.

[quoted text, click to view]


There is an onSoundComplete and an onID3 handler for Sound instances but not
one for playing progress.

I think sound playing "monitor" code (to move the scrubber button while it
plays) requires a setInterval that checks the Sound instance's position
property. They you can use the duration property and the position property
to move the scrubber button by computing a percentage.

The scrubber button can convert the scrub bar position into a percent and
multiplying that by (duration /1000) to get the Sound instance start method
seconds argument.

--
Lon Hosford
www.lonhosford.com
May many happy bits flow your way!
[quoted text, click to view]
Hi, im actually writing a very long script about that, you can find the
player
here https://www.auroradigital.net/raul/mp3Player/ im having doubts in how
to
implement the scrubber, if you could help me out I will appreciated.

To make the sound start streaming all you need to do is this

var mySound:Sound() = new Sound();
mySound.loadSound("file.mp3", true);

that "true" is key, says to Flash that the mp3 file is streaming

shawee
12/11/2005 6:32:10 PM
Hi eveybody,
I'm searching for a way to create streaming with the Sound class of
Actionscript.
As in :

http://www.estvideo.com/dew/index/2005/02/16/370-player-flash-mp3-leger-comme-un
e-plume
in wich you can see that the MP3 is displayed before it's completely loaded.
I've tried to launch start() method before the MP3 is totally loaded but
nothing happen.
If someone can help me, even if it's a tiny advice,
Thanks a lot,
Sylvain,
(Sorry for my english).
raulriera
12/11/2005 7:24:20 PM
Hi, im actually writing a very long script about that, you can find the player
here https://www.auroradigital.net/raul/mp3Player/ im having doubts in how to
implement the scrubber, if you could help me out I will appreciated.

To make the sound start streaming all you need to do is this

var mySound:Sound() = new Sound();
mySound.loadSound("file.mp3", true);

that "true" is key, says to Flash that the mp3 file is streaming
AddThis Social Bookmark Button