Can Actionscript load client side .wav files?
- janice_2k
- Novice


- Joined: Jun 03, 2004
- Posts: 28
- Status: Offline
- Anonymous
- Bot


- Joined: 25 Feb 2008
- Posts: ?
- Loc: Ozzuland
- Status: Online
July 15th, 2004, 9:05 pm
- janice_2k
- Novice


- Joined: Jun 03, 2004
- Posts: 28
- Status: Offline
Hi joebert,
I am trying to swap the codes mentioned in previous messages to calling client side mp3 first, then only play server side sound object. For example, it plays ClientAudio1.mp3 - serverAudio1, ClientAudio2.mp3 - serverAudio2, ClientAudio3.mp3 - serverAudio3 ... etc. However, I have no idea how could I 'swap' the functions. The following is the code that plays server side audio first before playing the client side mp3. Hope you could help me in swapping the scripts:
Looking forward to some replies soon.
Thanks in advance,
Janice
I am trying to swap the codes mentioned in previous messages to calling client side mp3 first, then only play server side sound object. For example, it plays ClientAudio1.mp3 - serverAudio1, ClientAudio2.mp3 - serverAudio2, ClientAudio3.mp3 - serverAudio3 ... etc. However, I have no idea how could I 'swap' the functions. The following is the code that plays server side audio first before playing the client side mp3. Hope you could help me in swapping the scripts:
Code: [ Select ]
on (release) {
stopAllSounds();
var iddiscussion = 1;
var numberFile = 3;
var serverCtr = 0;
var serverAudio = new Array("PE14_1a", "PE14_1c", "PE14_1e");
function discussion() {
server = new Sound();
serverFile = serverAudio[serverCtr];
server.attachSound(serverFile);
server.start(0, 0);
trace("SERVER "+serverFile+iddiscussion);
server.onSoundComplete = function() {
client = new Sound();
clientFile = "file:///c:/program files/IEBAudioRecorder/test"+iddiscussion+".mp3";
client.onLoad = function(success) {
//define conditions for success first
if (success) {
this.start();
client.onSoundComplete = function() {
if (iddiscussion<numberFile) {
iddiscussion++;
trace("Add counter to "+iddiscussion);
serverCtr++;
discussion();
}
};
} else {
//skip to the next file
trace("SOUND FAILED!!!");
if (iddiscussion<numberFile) {
iddiscussion++;
trace("Add counter to "+iddiscussion);
serverCtr++;
discussion();
}
}
};
client.loadSound(clientFile, true);
};
}
discussion();
}
stopAllSounds();
var iddiscussion = 1;
var numberFile = 3;
var serverCtr = 0;
var serverAudio = new Array("PE14_1a", "PE14_1c", "PE14_1e");
function discussion() {
server = new Sound();
serverFile = serverAudio[serverCtr];
server.attachSound(serverFile);
server.start(0, 0);
trace("SERVER "+serverFile+iddiscussion);
server.onSoundComplete = function() {
client = new Sound();
clientFile = "file:///c:/program files/IEBAudioRecorder/test"+iddiscussion+".mp3";
client.onLoad = function(success) {
//define conditions for success first
if (success) {
this.start();
client.onSoundComplete = function() {
if (iddiscussion<numberFile) {
iddiscussion++;
trace("Add counter to "+iddiscussion);
serverCtr++;
discussion();
}
};
} else {
//skip to the next file
trace("SOUND FAILED!!!");
if (iddiscussion<numberFile) {
iddiscussion++;
trace("Add counter to "+iddiscussion);
serverCtr++;
discussion();
}
}
};
client.loadSound(clientFile, true);
};
}
discussion();
}
- on (release) {
- stopAllSounds();
- var iddiscussion = 1;
- var numberFile = 3;
- var serverCtr = 0;
- var serverAudio = new Array("PE14_1a", "PE14_1c", "PE14_1e");
- function discussion() {
- server = new Sound();
- serverFile = serverAudio[serverCtr];
- server.attachSound(serverFile);
- server.start(0, 0);
- trace("SERVER "+serverFile+iddiscussion);
- server.onSoundComplete = function() {
- client = new Sound();
- clientFile = "file:///c:/program files/IEBAudioRecorder/test"+iddiscussion+".mp3";
- client.onLoad = function(success) {
- //define conditions for success first
- if (success) {
- this.start();
- client.onSoundComplete = function() {
- if (iddiscussion<numberFile) {
- iddiscussion++;
- trace("Add counter to "+iddiscussion);
- serverCtr++;
- discussion();
- }
- };
- } else {
- //skip to the next file
- trace("SOUND FAILED!!!");
- if (iddiscussion<numberFile) {
- iddiscussion++;
- trace("Add counter to "+iddiscussion);
- serverCtr++;
- discussion();
- }
- }
- };
- client.loadSound(clientFile, true);
- };
- }
- discussion();
- }
Looking forward to some replies soon.
Thanks in advance,
Janice
- joebert
- Sledgehammer


- Joined: Feb 10, 2004
- Posts: 13458
- Loc: Florida
- Status: Offline
If I read this right you want to load one sound from client side, then loop through the list of attachable server sounds once client completes.
I tried to keep this as close to the original as possible
I tried to keep this as close to the original as possible
Code: [ Select ]
on (release) {
stopAllSounds();
var iddiscussion = 1; /*This needs to reflect the number in the name of the client sound, it will be assigned a value of "false" once client is done with. */
var numberFile = 3;
var serverCtr = 0;
var serverAudio = new Array("PE14_1a", "PE14_1c", "PE14_1e");
function discussion() {
if(iddiscussion){
clientFile = "file:///c:/program files/IEBAudioRecorder/test"+iddiscussion+".mp3";
client = new Sound(this);
client.onLoad = function(success){
if(success){
client.onSoundComplete = function(){
if (iddiscussion<numberFile) {
iddiscussion = false;
trace("Add counter to "+iddiscussion);
delete client; //since we don't need it anymore
discussion();
}
}
trace("Client sound loaded, playing now.");
client.start();
}else{
trace("Client Load Failed");
}
}
client.loadSound(clientFile,true);
}else if(serverCtr < numberFile){
trace("Attaching next server sound.");
server = new Sound(this);
server.attachSound(serverAudio[serverCtr]);
server.onSoundComplete = function(){
trace("Server sound: "+serverAudio[serverCtr]+" finished playing.");
serverCtr++;
discussion();
}
server.start(0,0);
}else {
trace("Finished playing, deleting server soundObject");
delete server;
}
}
}
stopAllSounds();
var iddiscussion = 1; /*This needs to reflect the number in the name of the client sound, it will be assigned a value of "false" once client is done with. */
var numberFile = 3;
var serverCtr = 0;
var serverAudio = new Array("PE14_1a", "PE14_1c", "PE14_1e");
function discussion() {
if(iddiscussion){
clientFile = "file:///c:/program files/IEBAudioRecorder/test"+iddiscussion+".mp3";
client = new Sound(this);
client.onLoad = function(success){
if(success){
client.onSoundComplete = function(){
if (iddiscussion<numberFile) {
iddiscussion = false;
trace("Add counter to "+iddiscussion);
delete client; //since we don't need it anymore
discussion();
}
}
trace("Client sound loaded, playing now.");
client.start();
}else{
trace("Client Load Failed");
}
}
client.loadSound(clientFile,true);
}else if(serverCtr < numberFile){
trace("Attaching next server sound.");
server = new Sound(this);
server.attachSound(serverAudio[serverCtr]);
server.onSoundComplete = function(){
trace("Server sound: "+serverAudio[serverCtr]+" finished playing.");
serverCtr++;
discussion();
}
server.start(0,0);
}else {
trace("Finished playing, deleting server soundObject");
delete server;
}
}
}
- on (release) {
- stopAllSounds();
- var iddiscussion = 1; /*This needs to reflect the number in the name of the client sound, it will be assigned a value of "false" once client is done with. */
- var numberFile = 3;
- var serverCtr = 0;
- var serverAudio = new Array("PE14_1a", "PE14_1c", "PE14_1e");
- function discussion() {
- if(iddiscussion){
- clientFile = "file:///c:/program files/IEBAudioRecorder/test"+iddiscussion+".mp3";
- client = new Sound(this);
- client.onLoad = function(success){
- if(success){
- client.onSoundComplete = function(){
- if (iddiscussion<numberFile) {
- iddiscussion = false;
- trace("Add counter to "+iddiscussion);
- delete client; //since we don't need it anymore
- discussion();
- }
- }
- trace("Client sound loaded, playing now.");
- client.start();
- }else{
- trace("Client Load Failed");
- }
- }
- client.loadSound(clientFile,true);
- }else if(serverCtr < numberFile){
- trace("Attaching next server sound.");
- server = new Sound(this);
- server.attachSound(serverAudio[serverCtr]);
- server.onSoundComplete = function(){
- trace("Server sound: "+serverAudio[serverCtr]+" finished playing.");
- serverCtr++;
- discussion();
- }
- server.start(0,0);
- }else {
- trace("Finished playing, deleting server soundObject");
- delete server;
- }
- }
- }
Strong with this one, the sudo is.
- janice_2k
- Novice


- Joined: Jun 03, 2004
- Posts: 28
- Status: Offline
Hi JoeBert,
Thanks for your reply. As you can see from my previous code, I played server side sound object 1st, then proceed to client side mp3, then loop back to server-client, server-client ...etc.
Currently, I want to load client side mp3 first, then load server side sound object. If there is no client side mp3 at the 1st place, it will continue playing sound object. This will loop until all client side mp3 and server side sound objects finishes. For example: Client1.mp3 - Server1, Client2.mp3 - Server2, Client3.mp3 - Server3 ... etc. If Client2.mp3 does not exist, it will continue to Server2, then Client3.mp3 - Server3...etc
I tried your code, there seems to have some errors.
Looking forward to your reply soon.
Thanks in advance,
Janice
Thanks for your reply. As you can see from my previous code, I played server side sound object 1st, then proceed to client side mp3, then loop back to server-client, server-client ...etc.
Currently, I want to load client side mp3 first, then load server side sound object. If there is no client side mp3 at the 1st place, it will continue playing sound object. This will loop until all client side mp3 and server side sound objects finishes. For example: Client1.mp3 - Server1, Client2.mp3 - Server2, Client3.mp3 - Server3 ... etc. If Client2.mp3 does not exist, it will continue to Server2, then Client3.mp3 - Server3...etc
I tried your code, there seems to have some errors.
Looking forward to your reply soon.
Thanks in advance,
Janice
- joebert
- Sledgehammer


- Joined: Feb 10, 2004
- Posts: 13458
- Loc: Florida
- Status: Offline
In that case you can pull the actions for server.onSoundComplete() & create a function out of them, then swap the names of the functions around so that they call each other & have playClient() run first,
Code: [ Select ]
on (release) {
stopAllSounds();
var iddiscussion = 1;
var numberFile = 5;
var serverCtr = 0;
var serverAudio = ["test1","test2","test3","test4","test5"];
function playServer() {
server = new Sound();
serverFile = serverAudio[serverCtr];
server.attachSound(serverFile);
server.start(0, 0);
trace("SERVER "+serverFile+iddiscussion);
server.onSoundComplete = function() {
if(iddiscussion < numberFile){
playClient();
}else{
trace("Finished");
}
};
};
function playClient(){
client = new Sound();
clientFile = "file:///c:/test/s"+iddiscussion+".mp3";
client.onLoad = function(success) {
//define conditions for success first
if (success) {
this.start();
client.onSoundComplete = function() {
if (iddiscussion<=numberFile) {
iddiscussion++;
trace("Add counter to "+iddiscussion);
playServer();
serverCtr++;
}
};
} else {
//skip to the next file
trace("SOUND FAILED!!!");
if (iddiscussion<=numberFile) {
iddiscussion++;
trace("Add counter to "+iddiscussion);
playServer();
serverCtr++;
}
}
};
client.loadSound(clientFile, true);
}
playClient();
}
stopAllSounds();
var iddiscussion = 1;
var numberFile = 5;
var serverCtr = 0;
var serverAudio = ["test1","test2","test3","test4","test5"];
function playServer() {
server = new Sound();
serverFile = serverAudio[serverCtr];
server.attachSound(serverFile);
server.start(0, 0);
trace("SERVER "+serverFile+iddiscussion);
server.onSoundComplete = function() {
if(iddiscussion < numberFile){
playClient();
}else{
trace("Finished");
}
};
};
function playClient(){
client = new Sound();
clientFile = "file:///c:/test/s"+iddiscussion+".mp3";
client.onLoad = function(success) {
//define conditions for success first
if (success) {
this.start();
client.onSoundComplete = function() {
if (iddiscussion<=numberFile) {
iddiscussion++;
trace("Add counter to "+iddiscussion);
playServer();
serverCtr++;
}
};
} else {
//skip to the next file
trace("SOUND FAILED!!!");
if (iddiscussion<=numberFile) {
iddiscussion++;
trace("Add counter to "+iddiscussion);
playServer();
serverCtr++;
}
}
};
client.loadSound(clientFile, true);
}
playClient();
}
- on (release) {
- stopAllSounds();
- var iddiscussion = 1;
- var numberFile = 5;
- var serverCtr = 0;
- var serverAudio = ["test1","test2","test3","test4","test5"];
- function playServer() {
- server = new Sound();
- serverFile = serverAudio[serverCtr];
- server.attachSound(serverFile);
- server.start(0, 0);
- trace("SERVER "+serverFile+iddiscussion);
- server.onSoundComplete = function() {
- if(iddiscussion < numberFile){
- playClient();
- }else{
- trace("Finished");
- }
- };
- };
- function playClient(){
- client = new Sound();
- clientFile = "file:///c:/test/s"+iddiscussion+".mp3";
- client.onLoad = function(success) {
- //define conditions for success first
- if (success) {
- this.start();
- client.onSoundComplete = function() {
- if (iddiscussion<=numberFile) {
- iddiscussion++;
- trace("Add counter to "+iddiscussion);
- playServer();
- serverCtr++;
- }
- };
- } else {
- //skip to the next file
- trace("SOUND FAILED!!!");
- if (iddiscussion<=numberFile) {
- iddiscussion++;
- trace("Add counter to "+iddiscussion);
- playServer();
- serverCtr++;
- }
- }
- };
- client.loadSound(clientFile, true);
- }
- playClient();
- }
Strong with this one, the sudo is.
- janice_2k
- Novice


- Joined: Jun 03, 2004
- Posts: 28
- Status: Offline
Hi JoeBert,
I tested the code. It seems to play:
Client1.mp3,
Server2 - Client2.mp3,
Server3 - Client3.mp3.
It has skipped the first server side sound object and on the 2nd looping, it returns back to playing server side sound object first, rather than client side.
I was hoping it to play:
Client1.mp3 - Server1,
Client2.mp3 - Server2,
Client3.mp3 - Server3 ... etc
I tested the code. It seems to play:
Client1.mp3,
Server2 - Client2.mp3,
Server3 - Client3.mp3.
It has skipped the first server side sound object and on the 2nd looping, it returns back to playing server side sound object first, rather than client side.
I was hoping it to play:
Client1.mp3 - Server1,
Client2.mp3 - Server2,
Client3.mp3 - Server3 ... etc
- joebert
- Sledgehammer


- Joined: Feb 10, 2004
- Posts: 13458
- Loc: Florida
- Status: Offline
Theese two lines needed swapping,
It was incrementing the server count before playing the server file, causing the skip of ht efirst serverFile.
I've edited my previous post & swapped the two.
Code: [ Select ]
serverCtr++;
playServer();
playServer();
- serverCtr++;
- playServer();
It was incrementing the server count before playing the server file, causing the skip of ht efirst serverFile.
I've edited my previous post & swapped the two.
Strong with this one, the sudo is.
- janice_2k
- Novice


- Joined: Jun 03, 2004
- Posts: 28
- Status: Offline
Thanks Joebert,
I have noticed that after testing the amended code, the audio plays:
Client1.mp3 - Server1
Client2.mp3 - Server2
Client3
The last server side sound object -- 'Server3' went missing.
Besides, I noticed that when 1 of the client side mp3 file went missing, the functions seems to have error.
I removed Client2.mp3 from the client's computer. The audio I heard was:
Client1.mp3 - Server1
Server2
Client3.mp3
The 3rd sound object from server side -- Server3 seems to go missing. How should it be solved?
I was hoping that if one of the client side mp3 file does not exist, the audios will still continue playing. Example, if Client2.mp3 was missing, the audios played were:
Client1.mp3 - Server1
Server2
Client3.mp3 - Server3 ... etc
I apologize if I have troubled you so much. Hope to hear from you soon.
Thanks in advance,
Janice
I have noticed that after testing the amended code, the audio plays:
Client1.mp3 - Server1
Client2.mp3 - Server2
Client3
The last server side sound object -- 'Server3' went missing.
Besides, I noticed that when 1 of the client side mp3 file went missing, the functions seems to have error.
I removed Client2.mp3 from the client's computer. The audio I heard was:
Client1.mp3 - Server1
Server2
Client3.mp3
The 3rd sound object from server side -- Server3 seems to go missing. How should it be solved?
I was hoping that if one of the client side mp3 file does not exist, the audios will still continue playing. Example, if Client2.mp3 was missing, the audios played were:
Client1.mp3 - Server1
Server2
Client3.mp3 - Server3 ... etc
I apologize if I have troubled you so much. Hope to hear from you soon.
Thanks in advance,
Janice
- janice_2k
- Novice


- Joined: Jun 03, 2004
- Posts: 28
- Status: Offline
Hi Joebert,
I have edited part of the code you submitted earlier on. However, I have to change the variable "numberFile = 4" when I have 3 sound objects/audio files on server side. I also added an 'If-statement' in the playClient function, as it seems not to end the loop if I only change the numberFile = total number of audio files (numberFile = 3 when 3 sound objects)
The following is the code edited.
Would be glad if you could guide/find any problems/not logical areas of the code. Hope to hear from you soon.
Thanks in advance,
Janice
I have edited part of the code you submitted earlier on. However, I have to change the variable "numberFile = 4" when I have 3 sound objects/audio files on server side. I also added an 'If-statement' in the playClient function, as it seems not to end the loop if I only change the numberFile = total number of audio files (numberFile = 3 when 3 sound objects)
The following is the code edited.
Code: [ Select ]
on (release) {
stopAllSounds();
var iddiscussion = 1;
var numberFile = 4; //number of files + 1
var serverCtr = 0;
var serverAudio = new Array("PE14_1a", "PE14_1c", "PE14_1e");
function playServer() {
server = new Sound();
serverFile = serverAudio[serverCtr];
server.attachSound(serverFile);
server.start(0, 0);
trace("SERVER "+serverFile+iddiscussion);
server.onSoundComplete = function() {
playClient();
};
};
function playClient(){
if (iddiscussion<numberFile) {
trace(iddiscussion+" < "+ numberFile);
client = new Sound();
clientFile = "file:///c:/program files/IEBAudioRecorder/test"+iddiscussion+".mp3";
client.onLoad = function(success) {
//define conditions for success first
if (success) {
this.start();
trace("CLIENT "+clientFile+iddiscussion);
client.onSoundComplete = function() {
playServer(); //ADD
if (iddiscussion<numberFile) {
iddiscussion++;
trace("Add counter to "+iddiscussion);
//playServer();
serverCtr++;
}
};
} else {
//skip to the next file
trace("SOUND FAILED!!!");
playServer(); //ADD
if (iddiscussion<numberFile) {
iddiscussion++;
trace("Add counter to "+iddiscussion);
//playServer();
serverCtr++;
}
}
};
client.loadSound(clientFile, true);
};
}
playClient();
}
stopAllSounds();
var iddiscussion = 1;
var numberFile = 4; //number of files + 1
var serverCtr = 0;
var serverAudio = new Array("PE14_1a", "PE14_1c", "PE14_1e");
function playServer() {
server = new Sound();
serverFile = serverAudio[serverCtr];
server.attachSound(serverFile);
server.start(0, 0);
trace("SERVER "+serverFile+iddiscussion);
server.onSoundComplete = function() {
playClient();
};
};
function playClient(){
if (iddiscussion<numberFile) {
trace(iddiscussion+" < "+ numberFile);
client = new Sound();
clientFile = "file:///c:/program files/IEBAudioRecorder/test"+iddiscussion+".mp3";
client.onLoad = function(success) {
//define conditions for success first
if (success) {
this.start();
trace("CLIENT "+clientFile+iddiscussion);
client.onSoundComplete = function() {
playServer(); //ADD
if (iddiscussion<numberFile) {
iddiscussion++;
trace("Add counter to "+iddiscussion);
//playServer();
serverCtr++;
}
};
} else {
//skip to the next file
trace("SOUND FAILED!!!");
playServer(); //ADD
if (iddiscussion<numberFile) {
iddiscussion++;
trace("Add counter to "+iddiscussion);
//playServer();
serverCtr++;
}
}
};
client.loadSound(clientFile, true);
};
}
playClient();
}
- on (release) {
- stopAllSounds();
- var iddiscussion = 1;
- var numberFile = 4; //number of files + 1
- var serverCtr = 0;
- var serverAudio = new Array("PE14_1a", "PE14_1c", "PE14_1e");
- function playServer() {
- server = new Sound();
- serverFile = serverAudio[serverCtr];
- server.attachSound(serverFile);
- server.start(0, 0);
- trace("SERVER "+serverFile+iddiscussion);
- server.onSoundComplete = function() {
- playClient();
- };
- };
- function playClient(){
- if (iddiscussion<numberFile) {
- trace(iddiscussion+" < "+ numberFile);
- client = new Sound();
- clientFile = "file:///c:/program files/IEBAudioRecorder/test"+iddiscussion+".mp3";
- client.onLoad = function(success) {
- //define conditions for success first
- if (success) {
- this.start();
- trace("CLIENT "+clientFile+iddiscussion);
- client.onSoundComplete = function() {
- playServer(); //ADD
- if (iddiscussion<numberFile) {
- iddiscussion++;
- trace("Add counter to "+iddiscussion);
- //playServer();
- serverCtr++;
- }
- };
- } else {
- //skip to the next file
- trace("SOUND FAILED!!!");
- playServer(); //ADD
- if (iddiscussion<numberFile) {
- iddiscussion++;
- trace("Add counter to "+iddiscussion);
- //playServer();
- serverCtr++;
- }
- }
- };
- client.loadSound(clientFile, true);
- };
- }
- playClient();
- }
Would be glad if you could guide/find any problems/not logical areas of the code. Hope to hear from you soon.
Thanks in advance,
Janice
- joebert
- Sledgehammer


- Joined: Feb 10, 2004
- Posts: 13458
- Loc: Florida
- Status: Offline
I did the same edits, I put them in different spots though.
I changed server.onSoundComplete to,
& updated the main if/else statements inside client.onLoad to,
The < instead of <= was cutting it short, I caught/edited the endless loop while doing the <= . I added the if/else inside the server.onSoundComplete so that the event tests the statement instead of running the client function to do so.
I changed server.onSoundComplete to,
Code: [ Select ]
server.onSoundComplete = function() {
if(iddiscussion < numberFile){
playClient();
}else{
trace("Finished");
}
};
if(iddiscussion < numberFile){
playClient();
}else{
trace("Finished");
}
};
- server.onSoundComplete = function() {
- if(iddiscussion < numberFile){
- playClient();
- }else{
- trace("Finished");
- }
- };
& updated the main if/else statements inside client.onLoad to,
Code: [ Select ]
if (iddiscussion<=numberFile) {
The < instead of <= was cutting it short, I caught/edited the endless loop while doing the <= . I added the if/else inside the server.onSoundComplete so that the event tests the statement instead of running the client function to do so.
Strong with this one, the sudo is.
- janice_2k
- Novice


- Joined: Jun 03, 2004
- Posts: 28
- Status: Offline
Hi JoeBert,
Thanks for the editing. Your method works fine too
I have another inquery, what if there is one extra server side sound object which has no client side mp3 to be paired with? In other words, that I don't intend to change its name in the Array(like the ones I have on my previous codes) ? Example, I want the button to play:
ServerExtra,
Server1 - Client1.mp3,
Server2 - Client2.mp3,
Server3 - Client3.mp3 ... etc
How should I amend the code? The following is the code I used to play server/client audio files
Looking forward to your reply soon.
Thanks in advance,
Janice
Thanks for the editing. Your method works fine too
I have another inquery, what if there is one extra server side sound object which has no client side mp3 to be paired with? In other words, that I don't intend to change its name in the Array(like the ones I have on my previous codes) ? Example, I want the button to play:
ServerExtra,
Server1 - Client1.mp3,
Server2 - Client2.mp3,
Server3 - Client3.mp3 ... etc
How should I amend the code? The following is the code I used to play server/client audio files
Code: [ Select ]
on (release) {
stopAllSounds();
var iddiscussion = 1;
var numberFile = 3;
var serverCtr = 0;
var serverAudio = new Array("PE14_1a", "PE14_1c", "PE14_1e");
function discussion() {
server = new Sound();
//serverFile = "PE14_1d";
serverFile = serverAudio[serverCtr];
server.attachSound(serverFile);
//server side mp3
server.start(0, 0);
trace("SERVER "+serverFile+iddiscussion);
server.onSoundComplete = function() {
client = new Sound();
clientFile = "file:///c:/program files/IEBAudioRecorder/test"+iddiscussion+".mp3";
client.onLoad = function(success) {
//define conditions for success first
if (success) {
this.start();
trace("SOUND SUCCESS!!!");
client.onSoundComplete = function() {
//doesn't run if not success...
if (iddiscussion<numberFile) {
//no longer dependent on client.onSoundComplete
iddiscussion++;
trace("Add counter to "+iddiscussion);
serverCtr++;
discussion();
}
};
} else {
//skip to the next file
trace("SOUND FAILED!!!");
if (iddiscussion<numberFile) {
//no longer dependent on client.onSoundComplete
iddiscussion++;
trace("Add counter to "+iddiscussion);
serverCtr++;
discussion();
}
}
};
client.loadSound(clientFile, true);
//load client mp3
trace("CLIENT "+clientFile+iddiscussion);
};
}
discussion();
}
stopAllSounds();
var iddiscussion = 1;
var numberFile = 3;
var serverCtr = 0;
var serverAudio = new Array("PE14_1a", "PE14_1c", "PE14_1e");
function discussion() {
server = new Sound();
//serverFile = "PE14_1d";
serverFile = serverAudio[serverCtr];
server.attachSound(serverFile);
//server side mp3
server.start(0, 0);
trace("SERVER "+serverFile+iddiscussion);
server.onSoundComplete = function() {
client = new Sound();
clientFile = "file:///c:/program files/IEBAudioRecorder/test"+iddiscussion+".mp3";
client.onLoad = function(success) {
//define conditions for success first
if (success) {
this.start();
trace("SOUND SUCCESS!!!");
client.onSoundComplete = function() {
//doesn't run if not success...
if (iddiscussion<numberFile) {
//no longer dependent on client.onSoundComplete
iddiscussion++;
trace("Add counter to "+iddiscussion);
serverCtr++;
discussion();
}
};
} else {
//skip to the next file
trace("SOUND FAILED!!!");
if (iddiscussion<numberFile) {
//no longer dependent on client.onSoundComplete
iddiscussion++;
trace("Add counter to "+iddiscussion);
serverCtr++;
discussion();
}
}
};
client.loadSound(clientFile, true);
//load client mp3
trace("CLIENT "+clientFile+iddiscussion);
};
}
discussion();
}
- on (release) {
- stopAllSounds();
- var iddiscussion = 1;
- var numberFile = 3;
- var serverCtr = 0;
- var serverAudio = new Array("PE14_1a", "PE14_1c", "PE14_1e");
- function discussion() {
- server = new Sound();
- //serverFile = "PE14_1d";
- serverFile = serverAudio[serverCtr];
- server.attachSound(serverFile);
- //server side mp3
- server.start(0, 0);
- trace("SERVER "+serverFile+iddiscussion);
- server.onSoundComplete = function() {
- client = new Sound();
- clientFile = "file:///c:/program files/IEBAudioRecorder/test"+iddiscussion+".mp3";
- client.onLoad = function(success) {
- //define conditions for success first
- if (success) {
- this.start();
- trace("SOUND SUCCESS!!!");
- client.onSoundComplete = function() {
- //doesn't run if not success...
- if (iddiscussion<numberFile) {
- //no longer dependent on client.onSoundComplete
- iddiscussion++;
- trace("Add counter to "+iddiscussion);
- serverCtr++;
- discussion();
- }
- };
- } else {
- //skip to the next file
- trace("SOUND FAILED!!!");
- if (iddiscussion<numberFile) {
- //no longer dependent on client.onSoundComplete
- iddiscussion++;
- trace("Add counter to "+iddiscussion);
- serverCtr++;
- discussion();
- }
- }
- };
- client.loadSound(clientFile, true);
- //load client mp3
- trace("CLIENT "+clientFile+iddiscussion);
- };
- }
- discussion();
- }
Looking forward to your reply soon.
Thanks in advance,
Janice
- joebert
- Sledgehammer


- Joined: Feb 10, 2004
- Posts: 13458
- Loc: Florida
- Status: Offline
So... server0, server1, client1, server2, client2, ect.. ?
Easiest way would be to wrap the initiating call to discussion() inside an onSoundComplete for the extra server sound.
Skipping to the end,
Easiest way would be to wrap the initiating call to discussion() inside an onSoundComplete for the extra server sound.
Skipping to the end,
Code: [ Select ]
};
client.loadSound(clientFile, true);
//load client mp3
trace("CLIENT "+clientFile+iddiscussion);
};
}
extraServer = new Sound();
extraServer.attachSound("extraSoundLinkageId");
extraServer.onSoundComplete = function(){
discussion();
delete extraServer;
}
extraServer.start(0,0);
}
client.loadSound(clientFile, true);
//load client mp3
trace("CLIENT "+clientFile+iddiscussion);
};
}
extraServer = new Sound();
extraServer.attachSound("extraSoundLinkageId");
extraServer.onSoundComplete = function(){
discussion();
delete extraServer;
}
extraServer.start(0,0);
}
- };
- client.loadSound(clientFile, true);
- //load client mp3
- trace("CLIENT "+clientFile+iddiscussion);
- };
- }
- extraServer = new Sound();
- extraServer.attachSound("extraSoundLinkageId");
- extraServer.onSoundComplete = function(){
- discussion();
- delete extraServer;
- }
- extraServer.start(0,0);
- }
Strong with this one, the sudo is.
- janice_2k
- Novice


- Joined: Jun 03, 2004
- Posts: 28
- Status: Offline
- joebert
- Sledgehammer


- Joined: Feb 10, 2004
- Posts: 13458
- Loc: Florida
- Status: Offline
You have to make sure that the sound is linked for export like the other server sounds in the library.
Heres the full edit,
This worked fine for me.
Heres the full edit,
Code: [ Select ]
on (release) {
stopAllSounds();
var iddiscussion = 1;
var numberFile = 3;
var serverCtr = 0;
var serverAudio = new Array("PE14_1a", "PE14_1c", "PE14_1e");
function discussion() {
server = new Sound();
//serverFile = "PE14_1d";
serverFile = serverAudio[serverCtr];
server.attachSound(serverFile);
//server side mp3
server.start(0, 0);
trace("SERVER "+serverFile+iddiscussion);
server.onSoundComplete = function() {
client = new Sound();
clientFile = "file:///c:/program files/IEBAudioRecorder/test"+iddiscussion+".mp3";
client.onLoad = function(success) {
//define conditions for success first
if (success) {
this.start();
trace("SOUND SUCCESS!!!");
client.onSoundComplete = function() {
//doesn't run if not success...
if (iddiscussion<numberFile) {
//no longer dependent on client.onSoundComplete
iddiscussion++;
trace("Add counter to "+iddiscussion);
serverCtr++;
discussion();
}
};
} else {
//skip to the next file
trace("SOUND FAILED!!!");
if (iddiscussion<numberFile) {
//no longer dependent on client.onSoundComplete
iddiscussion++;
trace("Add counter to "+iddiscussion);
serverCtr++;
discussion();
}
}
};
client.loadSound(clientFile, true);
//load client mp3
trace("CLIENT "+clientFile+iddiscussion);
};
}
/*--------revised from here---------*/
extraSound = new Sound();
extraSound.attachSound("serverExtra"); /*make sure the name you give in linkage goes here inside the quotes*/
extraSound.onSoundComplete = function(){
discussion();
delete extraSound;
}
extraSound.start(0,0);
}
stopAllSounds();
var iddiscussion = 1;
var numberFile = 3;
var serverCtr = 0;
var serverAudio = new Array("PE14_1a", "PE14_1c", "PE14_1e");
function discussion() {
server = new Sound();
//serverFile = "PE14_1d";
serverFile = serverAudio[serverCtr];
server.attachSound(serverFile);
//server side mp3
server.start(0, 0);
trace("SERVER "+serverFile+iddiscussion);
server.onSoundComplete = function() {
client = new Sound();
clientFile = "file:///c:/program files/IEBAudioRecorder/test"+iddiscussion+".mp3";
client.onLoad = function(success) {
//define conditions for success first
if (success) {
this.start();
trace("SOUND SUCCESS!!!");
client.onSoundComplete = function() {
//doesn't run if not success...
if (iddiscussion<numberFile) {
//no longer dependent on client.onSoundComplete
iddiscussion++;
trace("Add counter to "+iddiscussion);
serverCtr++;
discussion();
}
};
} else {
//skip to the next file
trace("SOUND FAILED!!!");
if (iddiscussion<numberFile) {
//no longer dependent on client.onSoundComplete
iddiscussion++;
trace("Add counter to "+iddiscussion);
serverCtr++;
discussion();
}
}
};
client.loadSound(clientFile, true);
//load client mp3
trace("CLIENT "+clientFile+iddiscussion);
};
}
/*--------revised from here---------*/
extraSound = new Sound();
extraSound.attachSound("serverExtra"); /*make sure the name you give in linkage goes here inside the quotes*/
extraSound.onSoundComplete = function(){
discussion();
delete extraSound;
}
extraSound.start(0,0);
}
- on (release) {
- stopAllSounds();
- var iddiscussion = 1;
- var numberFile = 3;
- var serverCtr = 0;
- var serverAudio = new Array("PE14_1a", "PE14_1c", "PE14_1e");
- function discussion() {
- server = new Sound();
- //serverFile = "PE14_1d";
- serverFile = serverAudio[serverCtr];
- server.attachSound(serverFile);
- //server side mp3
- server.start(0, 0);
- trace("SERVER "+serverFile+iddiscussion);
- server.onSoundComplete = function() {
- client = new Sound();
- clientFile = "file:///c:/program files/IEBAudioRecorder/test"+iddiscussion+".mp3";
- client.onLoad = function(success) {
- //define conditions for success first
- if (success) {
- this.start();
- trace("SOUND SUCCESS!!!");
- client.onSoundComplete = function() {
- //doesn't run if not success...
- if (iddiscussion<numberFile) {
- //no longer dependent on client.onSoundComplete
- iddiscussion++;
- trace("Add counter to "+iddiscussion);
- serverCtr++;
- discussion();
- }
- };
- } else {
- //skip to the next file
- trace("SOUND FAILED!!!");
- if (iddiscussion<numberFile) {
- //no longer dependent on client.onSoundComplete
- iddiscussion++;
- trace("Add counter to "+iddiscussion);
- serverCtr++;
- discussion();
- }
- }
- };
- client.loadSound(clientFile, true);
- //load client mp3
- trace("CLIENT "+clientFile+iddiscussion);
- };
- }
- /*--------revised from here---------*/
- extraSound = new Sound();
- extraSound.attachSound("serverExtra"); /*make sure the name you give in linkage goes here inside the quotes*/
- extraSound.onSoundComplete = function(){
- discussion();
- delete extraSound;
- }
- extraSound.start(0,0);
- }
This worked fine for me.
Strong with this one, the sudo is.
- janice_2k
- Novice


- Joined: Jun 03, 2004
- Posts: 28
- Status: Offline
Hi Joebert,
Thanks for your guide and codes. I found the error on my sound object already. I didn't notice the sound object's name was "ExtraServer " with a space bar behind. Anyway, thank you so much for helping me. I really appreciate that. Should I have any other programming matters in near future, I would be very glad if you could also guide me. Have a nice day.
PS: Can we keep in touch by other means like msgr/icq?
Thank you
Janice
Thanks for your guide and codes. I found the error on my sound object already. I didn't notice the sound object's name was "ExtraServer " with a space bar behind. Anyway, thank you so much for helping me. I really appreciate that. Should I have any other programming matters in near future, I would be very glad if you could also guide me. Have a nice day.
PS: Can we keep in touch by other means like msgr/icq?
Thank you
Janice
- Anonymous
- Bot


- Joined: 25 Feb 2008
- Posts: ?
- Loc: Ozzuland
- Status: Online
August 10th, 2004, 9:55 pm
1, 2
To Reply to this topic you need to LOGIN or REGISTER. It is free.
Post Information
- Total Posts in this topic: 30 posts
- Users browsing this forum: No registered users and 29 guests
- You cannot post new topics in this forum
- You cannot reply to topics in this forum
- You cannot edit your posts in this forum
- You cannot delete your posts in this forum
- You cannot post attachments in this forum
