Can Actionscript load client side .wav files?

  • janice_2k
  • Novice
  • Novice
  • No Avatar
  • Joined: Jun 03, 2004
  • Posts: 28
  • Status: Offline

Post July 15th, 2004, 9:05 pm

Thanks Joebert for your information. As I still can't upload to the server due to some problems, I was worried about the outcome on the browser when I saw the output in the test movie. Anyway, its a relieve to hear that. Thank you so much and have a nice day. :)

Thanks,
Janice
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post July 15th, 2004, 9:05 pm

  • janice_2k
  • Novice
  • Novice
  • No Avatar
  • Joined: Jun 03, 2004
  • Posts: 28
  • Status: Offline

Post August 9th, 2004, 8:59 pm

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:

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();
}
  1. on (release) {
  2.     stopAllSounds();
  3.     var iddiscussion = 1;
  4.     var numberFile = 3;
  5.     var serverCtr = 0;
  6.     var serverAudio = new Array("PE14_1a", "PE14_1c", "PE14_1e");
  7.     function discussion() {
  8.         server = new Sound();
  9.         serverFile = serverAudio[serverCtr];
  10.         server.attachSound(serverFile);
  11.         server.start(0, 0);
  12.         trace("SERVER "+serverFile+iddiscussion);
  13.         server.onSoundComplete = function() {
  14.             client = new Sound();
  15.             clientFile = "file:///c:/program files/IEBAudioRecorder/test"+iddiscussion+".mp3";
  16.             client.onLoad = function(success) {
  17.                 //define conditions for success first
  18.                 if (success) {
  19.                     this.start();
  20.                     client.onSoundComplete = function() {
  21.                         if (iddiscussion<numberFile) {
  22.                             iddiscussion++;
  23.                             trace("Add counter to "+iddiscussion);
  24.                             serverCtr++;
  25.                             discussion();
  26.                         }
  27.                     };
  28.                 } else {
  29.                     //skip to the next file
  30.                     trace("SOUND FAILED!!!");
  31.                     if (iddiscussion<numberFile) {
  32.                         iddiscussion++;
  33.                         trace("Add counter to "+iddiscussion);
  34.                         serverCtr++;
  35.                         discussion();
  36.                     }
  37.                 }
  38.             };
  39.             client.loadSound(clientFile, true);
  40.         };
  41.     }
  42.     discussion();
  43. }


Looking forward to some replies soon.

Thanks in advance,
Janice
  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13455
  • Loc: Florida
  • Status: Offline

Post August 10th, 2004, 12:41 am

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 :)
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;
      }
  }
}
  1. on (release) {
  2.   stopAllSounds();
  3.   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. */
  4.   var numberFile = 3;
  5.   var serverCtr = 0;
  6.   var serverAudio = new Array("PE14_1a", "PE14_1c", "PE14_1e");
  7.   function discussion() {
  8.       if(iddiscussion){
  9.               clientFile = "file:///c:/program files/IEBAudioRecorder/test"+iddiscussion+".mp3";
  10.             client = new Sound(this);
  11.             client.onLoad = function(success){
  12.                 if(success){
  13.                     client.onSoundComplete = function(){
  14.                         if (iddiscussion<numberFile) {
  15.                    iddiscussion = false;
  16.                    trace("Add counter to "+iddiscussion);
  17.                              delete client; //since we don't need it anymore
  18.                    discussion();
  19.                  }
  20.                     }
  21.                     trace("Client sound loaded, playing now.");
  22.                     client.start();
  23.                 }else{
  24.                     trace("Client Load Failed");
  25.                 }
  26.             }
  27.             client.loadSound(clientFile,true);
  28.       }else if(serverCtr < numberFile){
  29.           trace("Attaching next server sound.");
  30.           server = new Sound(this);
  31.           server.attachSound(serverAudio[serverCtr]);
  32.           server.onSoundComplete = function(){
  33.               trace("Server sound: "+serverAudio[serverCtr]+" finished playing.");
  34.               serverCtr++;
  35.               discussion();
  36.           }
  37.           server.start(0,0);
  38.       }else {
  39.          trace("Finished playing, deleting server soundObject");
  40.          delete server;
  41.       }
  42.   }
  43. }
Strong with this one, the sudo is.
  • janice_2k
  • Novice
  • Novice
  • No Avatar
  • Joined: Jun 03, 2004
  • Posts: 28
  • Status: Offline

Post August 10th, 2004, 1:26 am

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
  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13455
  • Loc: Florida
  • Status: Offline

Post August 10th, 2004, 2:59 am

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();
}
  1. on (release) {
  2.   stopAllSounds();
  3.   var iddiscussion = 1;
  4.   var numberFile = 5;
  5.   var serverCtr = 0;
  6.   var serverAudio = ["test1","test2","test3","test4","test5"];
  7.   function playServer() {
  8.    server = new Sound();
  9.    serverFile = serverAudio[serverCtr];
  10.    server.attachSound(serverFile);
  11.    server.start(0, 0);
  12.    trace("SERVER "+serverFile+iddiscussion);
  13.    server.onSoundComplete = function() {
  14.          if(iddiscussion < numberFile){
  15.             playClient();
  16.          }else{
  17.              trace("Finished");
  18.          }
  19.    };
  20.   };
  21.   function playClient(){
  22.    client = new Sound();
  23.       clientFile = "file:///c:/test/s"+iddiscussion+".mp3";
  24.       client.onLoad = function(success) {
  25.       //define conditions for success first
  26.       if (success) {
  27.         this.start();
  28.         client.onSoundComplete = function() {
  29.         if (iddiscussion<=numberFile) {
  30.           iddiscussion++;
  31.           trace("Add counter to "+iddiscussion);
  32.                 playServer();
  33.           serverCtr++;
  34.         }
  35.       };
  36.      } else {
  37.         //skip to the next file
  38.         trace("SOUND FAILED!!!");
  39.         if (iddiscussion<=numberFile) {
  40.          iddiscussion++;
  41.          trace("Add counter to "+iddiscussion);
  42.          playServer();
  43.          serverCtr++;
  44.         }
  45.       }
  46.      };
  47.      client.loadSound(clientFile, true);  
  48.   }
  49.   playClient();
  50. }
Strong with this one, the sudo is.
  • janice_2k
  • Novice
  • Novice
  • No Avatar
  • Joined: Jun 03, 2004
  • Posts: 28
  • Status: Offline

Post August 10th, 2004, 6:09 pm

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
  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13455
  • Loc: Florida
  • Status: Offline

Post August 10th, 2004, 7:09 pm

Theese two lines needed swapping,
Code: [ Select ]
serverCtr++;
playServer();
  1. serverCtr++;
  2. 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
  • Novice
  • No Avatar
  • Joined: Jun 03, 2004
  • Posts: 28
  • Status: Offline

Post August 10th, 2004, 7:16 pm

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
  • janice_2k
  • Novice
  • Novice
  • No Avatar
  • Joined: Jun 03, 2004
  • Posts: 28
  • Status: Offline

Post August 10th, 2004, 7:54 pm

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.
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();
}
  1. on (release) {
  2.   stopAllSounds();
  3.   var iddiscussion = 1;
  4.   var numberFile = 4; //number of files + 1
  5.   var serverCtr = 0;
  6.   var serverAudio = new Array("PE14_1a", "PE14_1c", "PE14_1e");
  7.   function playServer() {
  8.    server = new Sound();
  9.    serverFile = serverAudio[serverCtr];
  10.    server.attachSound(serverFile);
  11.    server.start(0, 0);
  12.    trace("SERVER "+serverFile+iddiscussion);
  13.    server.onSoundComplete = function() {
  14.      playClient();
  15.    };
  16.   };
  17.   function playClient(){
  18.    if (iddiscussion<numberFile) {
  19.         trace(iddiscussion+" < "+ numberFile);
  20.    client = new Sound();
  21.       clientFile = "file:///c:/program files/IEBAudioRecorder/test"+iddiscussion+".mp3";
  22.       client.onLoad = function(success) {
  23.       //define conditions for success first
  24.       if (success) {
  25.         this.start();
  26.         trace("CLIENT "+clientFile+iddiscussion);
  27.             client.onSoundComplete = function() {
  28.         playServer(); //ADD
  29.         if (iddiscussion<numberFile) {
  30.           iddiscussion++;
  31.           trace("Add counter to "+iddiscussion);
  32.                 //playServer();
  33.           serverCtr++;
  34.         }
  35.       };
  36.      } else {
  37.         //skip to the next file
  38.         trace("SOUND FAILED!!!");
  39.               playServer(); //ADD
  40.         if (iddiscussion<numberFile) {
  41.          iddiscussion++;
  42.          trace("Add counter to "+iddiscussion);
  43.          //playServer();
  44.          serverCtr++;
  45.         }
  46.       }
  47.      };
  48.      client.loadSound(clientFile, true);  
  49.    };
  50.   }
  51.   playClient();
  52. }

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
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13455
  • Loc: Florida
  • Status: Offline

Post August 10th, 2004, 8:14 pm

I did the same edits, I put them in different spots though.

I changed server.onSoundComplete to,
Code: [ Select ]
server.onSoundComplete = function() {
         if(iddiscussion < numberFile){
            playClient();
         }else{
             trace("Finished");
         }
   };
  1. server.onSoundComplete = function() {
  2.          if(iddiscussion < numberFile){
  3.             playClient();
  4.          }else{
  5.              trace("Finished");
  6.          }
  7.    };


& 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
  • Novice
  • No Avatar
  • Joined: Jun 03, 2004
  • Posts: 28
  • Status: Offline

Post August 10th, 2004, 8:29 pm

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
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();
}
  1. on (release) {
  2.     stopAllSounds();
  3.     var iddiscussion = 1;
  4.     var numberFile = 3;
  5.     var serverCtr = 0;
  6.     var serverAudio = new Array("PE14_1a", "PE14_1c", "PE14_1e");
  7.     function discussion() {
  8.         server = new Sound();
  9.         //serverFile = "PE14_1d";
  10.         serverFile = serverAudio[serverCtr];
  11.         server.attachSound(serverFile);
  12.         //server side mp3
  13.         server.start(0, 0);
  14.         trace("SERVER "+serverFile+iddiscussion);
  15.         server.onSoundComplete = function() {
  16.             client = new Sound();
  17.             clientFile = "file:///c:/program files/IEBAudioRecorder/test"+iddiscussion+".mp3";
  18.             client.onLoad = function(success) {
  19.                 //define conditions for success first
  20.                 if (success) {
  21.                     this.start();
  22.                     trace("SOUND SUCCESS!!!");
  23.                     client.onSoundComplete = function() {
  24.                         //doesn't run if not success...
  25.                         if (iddiscussion<numberFile) {
  26.                             //no longer dependent on client.onSoundComplete
  27.                             iddiscussion++;
  28.                             trace("Add counter to "+iddiscussion);
  29.                             serverCtr++;
  30.                             discussion();
  31.                         }
  32.                     };
  33.                 } else {
  34.                     //skip to the next file
  35.                     trace("SOUND FAILED!!!");
  36.                     if (iddiscussion<numberFile) {
  37.                         //no longer dependent on client.onSoundComplete
  38.                         iddiscussion++;
  39.                         trace("Add counter to "+iddiscussion);
  40.                         serverCtr++;
  41.                         discussion();
  42.                     }
  43.                 }
  44.             };
  45.             client.loadSound(clientFile, true);
  46.             //load client mp3
  47.             trace("CLIENT "+clientFile+iddiscussion);
  48.         };
  49.     }
  50.     discussion();
  51. }


Looking forward to your reply soon.

Thanks in advance,
Janice
  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13455
  • Loc: Florida
  • Status: Offline

Post August 10th, 2004, 8:57 pm

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,
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);
}
  1.     };
  2.      client.loadSound(clientFile, true);
  3.      //load client mp3
  4.      trace("CLIENT "+clientFile+iddiscussion);
  5.    };
  6.   }
  7. extraServer = new Sound();
  8. extraServer.attachSound("extraSoundLinkageId");
  9. extraServer.onSoundComplete = function(){
  10.   discussion();
  11.   delete extraServer;
  12. }
  13. extraServer.start(0,0);
  14. }
Strong with this one, the sudo is.
  • janice_2k
  • Novice
  • Novice
  • No Avatar
  • Joined: Jun 03, 2004
  • Posts: 28
  • Status: Offline

Post August 10th, 2004, 9:12 pm

Sorry Joebert,
It seems not to work at all.

By the way, the extra sound object will not have the same format of file name as the ones we have. The file name might be ServerExtra instead of Server0
  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13455
  • Loc: Florida
  • Status: Offline

Post August 10th, 2004, 9:38 pm

You have to make sure that the sound is linked for export like the other server sounds in the library.
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);
}
  1. on (release) {
  2.   stopAllSounds();
  3.   var iddiscussion = 1;
  4.   var numberFile = 3;
  5.   var serverCtr = 0;
  6.   var serverAudio = new Array("PE14_1a", "PE14_1c", "PE14_1e");
  7.   function discussion() {
  8.    server = new Sound();
  9.    //serverFile = "PE14_1d";
  10.    serverFile = serverAudio[serverCtr];
  11.    server.attachSound(serverFile);
  12.    //server side mp3
  13.    server.start(0, 0);
  14.    trace("SERVER "+serverFile+iddiscussion);
  15.    server.onSoundComplete = function() {
  16.      client = new Sound();
  17.      clientFile = "file:///c:/program files/IEBAudioRecorder/test"+iddiscussion+".mp3";
  18.      client.onLoad = function(success) {
  19.       //define conditions for success first
  20.       if (success) {
  21.         this.start();
  22.         trace("SOUND SUCCESS!!!");
  23.         client.onSoundComplete = function() {
  24.          //doesn't run if not success...
  25.          if (iddiscussion<numberFile) {
  26.            //no longer dependent on client.onSoundComplete
  27.            iddiscussion++;
  28.            trace("Add counter to "+iddiscussion);
  29.            serverCtr++;
  30.            discussion();
  31.          }
  32.         };
  33.       } else {
  34.         //skip to the next file
  35.         trace("SOUND FAILED!!!");
  36.         if (iddiscussion<numberFile) {
  37.          //no longer dependent on client.onSoundComplete
  38.          iddiscussion++;
  39.          trace("Add counter to "+iddiscussion);
  40.          serverCtr++;
  41.          discussion();
  42.         }
  43.       }
  44.      };
  45.      client.loadSound(clientFile, true);
  46.      //load client mp3
  47.      trace("CLIENT "+clientFile+iddiscussion);
  48.    };
  49.   }
  50. /*--------revised from here---------*/
  51. extraSound = new Sound();
  52. extraSound.attachSound("serverExtra"); /*make sure the name you give in linkage goes here inside the quotes*/
  53. extraSound.onSoundComplete = function(){
  54.   discussion();
  55.   delete extraSound;
  56. }
  57. extraSound.start(0,0);
  58. }


This worked fine for me.
Strong with this one, the sudo is.
  • janice_2k
  • Novice
  • Novice
  • No Avatar
  • Joined: Jun 03, 2004
  • Posts: 28
  • Status: Offline

Post August 10th, 2004, 9:55 pm

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
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post August 10th, 2004, 9:55 pm

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
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.