Swapping part of the script

  • janice_2k
  • Novice
  • Novice
  • janice_2k
  • Posts: 28

Post 3+ Months Ago

Dear gurus/members,
I am new to actionscript. I have created a script that will play server side sound object and client side mp3 files alternately. Now, I would like to play the client side mp3 first then only play server side sound object alternately. However, I have no idea how can I do so. The following is the code that need to be swapped:
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);
        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() {
                        //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
        };
    }
    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.         server.onSoundComplete = function() {
  15.             client = new Sound();
  16.             clientFile = "file:///c:/program files/IEBAudioRecorder/test"+iddiscussion+".mp3";
  17.             client.onLoad = function(success) {
  18.                 //define conditions for success first
  19.                 if (success) {
  20.                     this.start();
  21.                     client.onSoundComplete = function() {
  22.                         //doesn't run if not success...
  23.                         if (iddiscussion<numberFile) {
  24.                             //no longer dependent on client.onSoundComplete
  25.                             iddiscussion++;
  26.                             trace("Add counter to "+iddiscussion);
  27.                             serverCtr++;
  28.                             discussion();
  29.                         }
  30.                     };
  31.                 } else {
  32.                     //skip to the next file
  33.                     trace("SOUND FAILED!!!");
  34.                     if (iddiscussion<numberFile) {
  35.                         //no longer dependent on client.onSoundComplete
  36.                         iddiscussion++;
  37.                         trace("Add counter to "+iddiscussion);
  38.                         serverCtr++;
  39.                         discussion();
  40.                     }
  41.                 }
  42.             };
  43.             client.loadSound(clientFile, true);
  44.             //load client mp3
  45.         };
  46.     }
  47.     discussion();
  48. }

How to make it in a way that it will play the client mp3 first then only server side sound object? Looking forward to some reply soon.

Thanks in advance,
Janice
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

Post Information

  • Total Posts in this topic: 1 post
  • Users browsing this forum: No registered users and 14 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
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.