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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help urgently to modify/swap part of the codes

Status
Not open for further replies.

janicefoo

Programmer
Apr 17, 2003
53
0
0
MY
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:
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();
}

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top