Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 02-10-2009, 08:41 PM   #1
LJD
Registered User
 
Join Date: Feb 2009
Posts: 1
Default Interactive Sound Game

Hi. Apologies if this has already been covered it's just I’m not entirely sure what I need to do so was unsure of what to search for.

The game is composed of a scene that contains buttons that play different sounds when pressed. The user clicks a button, 'record', which records the sequence in which they press the buttons and they can then play their sequence back using a 'play' button.

I understand I need to use an array to do this but how I would go about this is what I am lost about. I hope I have been clear enough on my description and any help would be greatly appreciated.

Thanks.
LJD is offline   Reply With Quote
Old 02-10-2009, 10:45 PM   #2
neilmmm
Senior Member
 
neilmmm's Avatar
 
Join Date: Oct 2005
Location: dorset
Posts: 1,637
Default

something like
Code:
var soundArray:Array = new Array();
var s:Sound = new Sound();
var counter:Number = 0;
var soundLength:Number = 0;
s1_mc.onRelease = function() {
	s.attachSound("s1");
	s.start();
	soundArray.push("s1");
};
s2_mc.onRelease = function() {
	s.attachSound("s2");
	s.start();
	soundArray.push("s2");
};
s3_mc.onRelease = function() {
	s.attachSound("s3");
	s.start();
	soundArray.push("s3");
};
clear_mc.onRelease = function() {
	soundArray = [];
};
function playSounds() {
	soundLength = soundArray.length;
	if (counter<soundArray.length) {
		s.attachSound(soundArray[counter]);
		s.start();
		counter++;
		s.onSoundComplete = playSounds;
	} else {
		counter = 0;
		delete s.onSoundComplete;
	}
}
play_mc.onRelease = function() {
	playSounds();
};
s1_mc.inner_txt.text = "sound 1";
s2_mc.inner_txt.text = "sound 2";
s3_mc.inner_txt.text = "sound 3";
clear_mc.inner_txt.text = "clear";
play_mc.inner_txt.text = "play";
Attached Files
File Type: zip play array of sounds.zip (89.6 KB, 73 views)
neilmmm is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[AS3] interactive game mabdog Gaming and Game Development 2 01-15-2008 07:03 PM
[AS3] Building Interactive Paint Game animatorjb Gaming and Game Development 0 10-18-2007 05:34 PM
drag & drop audio - slight problem :) whiteybags ActionScript 1.0 (and below) 6 05-31-2004 02:39 PM
event sound between scenes larussell Other Flash General Questions 4 07-24-2003 07:42 PM
help with sound!! uramis ActionScript 1.0 (and below) 0 07-09-2002 02:36 AM


All times are GMT. The time now is 07:30 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.