Click to See Complete Forum and Search --> : Can Actionscript play client side mp3 files?


janice_2k4
06-30-2004, 04:01 AM
Dear gurus and members,

I am a newbie in actionscript and other scripting. I wonder whether it is possible for actionscript to read mp3 files located on the client's computer. I have a flash button embedded on my website (online) that should play server side and client side mp3 files alternately. For example: Q1(server)-A1(client), Q2-A2...etc with just a click on a button.

The following is the code I tested to see if actionscript can play a client side mp3 file:

on (release) {
stopAllSounds();
PE14Conv1e = new Sound();
PE14Convle.loadSound("file:///c:/Program Files/Sound Recording/AudioRecorder/NewSong52211.mp3");
PE14Conv1e.start(0, 0);
}


I have placed the .mp3 file in the folder correctly but when I tested the movie and build swf file (without uploading to the server yet as there are some difficulties in uploading to my server these few days), it does not play the mp3.

I did the same method on another button that calls server side mp3 file. However, this one works fine when I tested:


on (release) {
stopAllSounds();
PE14Conv1d = new Sound();
PE14Conv1d.attachSound("PE14_1d");
PE14Conv1d.start(0, 0);
}


I have no idea how to solve the problem in playing client side mp3 files from the Flash button on my website. Looking forward t some reply soon.

Thanks in advance,
Janice

buntine
06-30-2004, 11:51 PM
It seems nobody knows the answer! Try posting your question in the forums at flashkit.com.

http://www.flashkit.com/index.shtml

Regards.

janice_2k4
07-01-2004, 12:02 AM
Thanks buntine,
This method works fine

on (release)
{
stopAllSounds();
mySound = new Sound();
mySound.loadSound("file:///c:/program files/sound recording/audiorecorder/newsong52211.mp3", true);
mySound.start();
}

It was my mistake previously. Anyway, How can I make it in such ways that it will play serverside mp3 and client side mp3 alternately from the beginning till the end? For example:Q1(server side mp3)-A1(client side mp3), Q2-A2, Q3-A3...etc? The file name is fixed as: audio# for server side & test# for client side. ('#' = number). I think there should be a var that will check for the number of mp3s from the server and assign the value to a loop to play the mp3s. I would very glad if you could help me as I have no idea at all about actionscript and the language. I am at total lost. Looking forward to some reply soon.

Thanks in advance,
Janice

janice_2k4
07-11-2004, 10:16 PM
Hi Buntine,
I tried playing the mp3 files from both server and client side alternately and currently, it works fine. Though, there is a problem as, if one of the files does not exist, an error will occur and this will terminate the script without continuing playing the mp3s. The code is as below:


on(release){

var iddiscussion = 1;
var numberFile = 4;

function discussion() {
server = new Sound();
trace("in new Sound");
server.attachSound("PE14_1d"+iddiscussion+".mp3");
server.start(0, 0);
server.onSoundComplete = function () {
client = new Sound();
client.loadSound("file:///c:/program files/sound recording/audiorecorder/test"+iddiscussion+".mp3", true);
client.onLoad = function(success) {
this.start();
}
client.onSoundComplete = function () {
iddiscussion++;
if (iddiscussion < numberFile) {
discussion();
}
}
}
}
discussion();

}


How can I check for the files whether it exist? If the file does not, it will proceed to the next mp3 files without prompting any error. I would be glad if you could guide me in this part as I am quite lost here. Looking forward to your reply soon.

Thanks in advance,
Janice

buntine
07-11-2004, 11:44 PM
Im sorry, but im not a flash-man. I am not familiar with Actionscript. :(

The Web Site i posted above may be of more help for Flash programming related questions.

Regards,
Andrew Buntine.

janice_2k4
07-12-2004, 01:55 AM
Hi Buntine,
Its ok. Do you know any sites or people that could help me in this? Anyway, thanks for the replies. Have a pleasant day.

Thanks,
Janice

buntine
07-12-2004, 06:28 AM
Yes, the guys at FlashKit will help you out. I posted the link in my first post.

www.flashkit.com

Regards.

janice_2k4
07-12-2004, 09:32 PM
Thanks buntine. Have a nice day.

Janice

schizo
07-13-2004, 10:02 AM
Having been featured on flashkit and post regularly in their forums, I'd rather recommend visiting were-here's forums (http://www.were-here.com) for answers relating to actionscript.

janice_2k4
07-13-2004, 07:50 PM
Thanks schizo. I will drop a thread at the site. Have a nice day.

Cheers,
Janice