Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can actionscript play client side mp3 files?

Status
Not open for further replies.

janicefoo

Programmer
Joined
Apr 17, 2003
Messages
53
Location
MY
Dear gurus and members,

I am a newbie in Flash MX 2004 and Actionscript. I would like to know whether is it possible that Actionscript load/playback .mo3 files located on user's computer? How can I work about this?

I would like to create a button that will play mp3 files stored in the library(server) as well as .mp3 files on the user's computer afternately. The mp3 files on client side computer are located at a specific path, at c://program files/sound recording/audio recorder folder. I would be glad if someone could share the knowledge and expertise in this area with me. Any suggestions and ideas are highly appreciated. Looking forward to some reply soon.


Thanks in advance,
Janice
 
Hi oldnewbie,
Thanks for the url u posted. Though I wonder if there are other methods to work it out? As I need to playback mp3 files on the server and client side alternately, it seems abit complicated to use the method used by the guy.

I tried using loadSound to load 1 client side mp3 and it works. Though I wonder if that's possible to use loadSound to playback server and client side mp3 continuously? Maybe by adding counter, if-else statement? I am very new in actionscript and programming. I would really appreciate if you could show me a sample of the codes. Looking forward to your reply soon.

Thanks in advance,
Janice
 
I downloaded. There is an .as file. I opened using notepad but I am very confused with the codings. I know nothing about actionscript :( Besides, I don't need an 'application' to play, stop, rewind or forward. I just need a button to playback server and client side mp3s. I wonder if is there any simpler ways to work things out. Or, can you guide me with the source? Or is there a better ways to contact you, like through msn messenger?
 
Thanks. I will take a look at it.
 
Hi oldnewbie,
I have browse through the site. However, I have found another method to call the server and user side mp3 files. I used attachSound for server side mp3 and loadSound for client side mp3. However, there are some bugs that I am clueless on how to solve. If either one of the mp3 files does not exist, it will have an error and terminate the script without proceeding to the later files. The following is the code i used:

on(release){
var iddiscussion = 1;
var numberFile = 4;

function discussion() {
server = new Sound();
server.attachSound("PE14_1d"+iddiscussion+".mp3"); //server side 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 side mp3
client.onLoad = function(success) {
this.start();
}
client.onSoundComplete = function () {
iddiscussion++;
if (iddiscussion < numberFile) {
discussion();
}
}
}
}
discussion();
}

It works perfectly when all the files exists on the correct path and folders. However, if either on of the file does not exist, it will terminate the script without completing all playback. There will be an error and will later terminate this task without proceeding to the following files.

How can I make it in such a way that it will ignore the non-existing file and proceed to the other mp3s without causing any errors? For example: If test2.mp3 (client side)does not exist, the script will play PE14_1d2.mp3(server side), (skip test2.mp3), PE14_1d3.mp3 (server side again) and followed by test3.mp3(client side)? I would be very glad if someone could guide me. Looking forward to some replies soon.

Thanks in advance,
Janice
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top