Groups | Blog | Home
all groups > flash actionscript > november 2004 >

flash actionscript : Media Player continuous songs


jamehart
11/27/2004 7:35:46 PM
Hi, I would appreciate it if you could help with the actionscript in a web
media player I have. If you go to bencaudillartist.com/player.swf you will see
that the songs load and play but for example, song 1 stops after it is done,
and then song 2 does not stream. I need something that will load song 2 after 1
stops, and so on. 2 to 3, 3 to 4, and 4 to 5. Also an example of what I want is
here - www.the-obar.com/obar.swf, then click on dj sets, then launch the media
player at the bottom.

I have uploaded the source .fla file to here if you need it -
www.bencaudillartist.com/flafile.fla



Thanks for any help
kennybellew
11/27/2004 7:58:11 PM
It looks like you're loading them streaming from an XML playlist. The trouble
is that you don't immediately know the durration of a streaming sound. If they
weren't streaming, it would be simple. The duration property is not accuarate
for a streamng sound until it fully loads, so if you write a condition to go to
the next song when the position property equals the duration property, it will
prematurely change tracks. I'm thinking out loud.... Of course, if your
playlist is fairly static, you could determine the duration for each song by
using a trace, then add that value to your xml playlist. When the duration is
reached, you could advance to the next song. If you are the one who coded that
player, I'm guessing you followed that.
jamehart
11/27/2004 8:03:14 PM
Actually, I just customized it. The coder was off of flashmovies.com. The xml
list is located here - http://bencaudillartist.com/audiolist.xml

I'm actually very new to flash, and I can manage to go into the actionscripts
and customize those but I cannot code from scratch or from the top of my head.
What is your recommendation as far as what to do with the coding from the .xml
file I showed you.

Thanks
kennybellew
11/27/2004 8:15:22 PM
That player has a sound object called MySound. Add a line like: trace
(MySound.duration/1000); That will tell you the duration of your sound that
is playing. Frankly, telling you how to customize that player would take pages
and pages of explanation that I don't have time for right now. But to point
you in the direction, trace the duration, create an if condition that compares
the Mysound.position to the Mysound.duration, when they are equal, have it do
whatever is programmed to happen when the next button is pressed. You'll also
have to watch the length of the xml file, and when the length is reached, send
it back to the beginning.
jamehart
11/27/2004 8:17:29 PM
Do you mean this -

MySound.loadSound(AudioPath, StreamSignal);
MySound.setVolume(volume);
MySound.setPan(balance);
MySound.onSoundComplete=function(){
kugel_mc._visible = 0;
playSignal = false;
status = "Status: stopped";

And if so, what should i add or change.

Thanks
jamehart
11/27/2004 8:47:44 PM
DenisBB
11/27/2004 10:59:40 PM
there is a method onSoundComplete in Sound class

--
DenisBB,
DBB crew.



[quoted text, click to view]

AddThis Social Bookmark Button