PDA

**See This Page With Full Graphics, Pictures and Color!** CLICK HERE --> : Flash Gurus, I need some help


sniper
11-16-2006, 04:39 PM
I'm working on my first soundboard, but it's going to be more of a downloadable board as opposed to something you can use from a site.

I can create the buttons and all just fine, tie them to sounds... no problem.
What I need is a good explanation and/or quick tutorial on how to bind these sound buttons to keyboard keys so when you press a key the sound plays.

Any help would be appreciated, this will be an ongoing project and will be posted here.

ImAlrightSpider
11-16-2006, 08:53 PM
ActionScript. onKeyDown I think.

How are you tying the buttons to sounds? Are you already scripting, or are you using the properties panel?

SOS
11-17-2006, 04:27 AM
MACE is an expert; you should ask him.

sniper
11-18-2006, 02:58 PM
ActionScript. onKeyDown I think.

How are you tying the buttons to sounds? Are you already scripting, or are you using the properties panel?

OK, I've been through 37653765 tutorials now.
Yeah, the actual soundboard, pressing the buttons with the mouse is easy and all and works, I've never dealt with action script, been getting my feet wet with it the past 2 days.
All the tutorials I've seen use the keyPress directive, but only with buttons like <space> <left> <right> <end> etc...
I know you have to link the keyPress to a button, which I finally figured out last night. There's plenty of tutorials and help on how to stop sounds that are playing. like:
on(keyPress "<Space>"){
stopAllSounds();
**

But I can't find shit on how to PLAY a sound with a button, I keep seeing shit about listeners for buttons other than the ones i mentioned above, like using a,b,c, etc...

I found some stuff last night but it didn't pan out, ultimately I want to have a multiple frame sound board, selectable by categories with 26 or so sounds each so each letter on the keyboard can play a different sound. I tried some code last night which I can't remember (i'm at work so it's not in front of me) What I didn't know was to give the sound file a variable name so i was doing something like playsound(soundfile.mp3), flash wasn't happy, so i'll try that when I get home and post my results here.

sniper
11-18-2006, 06:10 PM
Update:
Still can't get it to work, I've read a few more things around the web and now i'm not sure if I have to call the sound as a variable in the scene itself or another scene first, then call it with the button, but that'd be a huge pain in the ass.... I'll keep playing around.

ImAlrightSpider
11-18-2006, 06:24 PM
ok, I looked in a book -

you probably want to use something like this. I'm fairly new at this, but am working out of a book:

sndWakawaka = new Sound(); // create a Sound object for every sound you will play. Repeat for every sound you import into the Library.

sndWakawaka.attachSound("waka.wav"); // Connect the Sound object to the file in the Library. The text inside the "" is the name of the audio element in the Library (NOT the filename of a particular file).

if(Key.isDown(65)){
sndWakawaka.start();
** // In this example, 65 is the Ascii value for "A". I think that you have to use the Ascii code to trap the particular key pressed.



I don't know if I'm of any help here, but it's helping me learn it myself. Of course, the above code needs to be part of some function in ActionScript.

Good luck.

sniper
11-18-2006, 06:46 PM
ok, I looked in a book -

you probably want to use something like this. I'm fairly new at this, but am working out of a book:

sndWakawaka = new Sound(); // create a Sound object for every sound you will play. Repeat for every sound you import into the Library.

sndWakawaka.attachSound("waka.wav"); // Connect the Sound object to the file in the Library. The text inside the "" is the name of the audio element in the Library (NOT the filename of a particular file).

if(Key.isDown(65)){
sndWakawaka.start();
** // In this example, 65 is the Ascii value for "A". I think that you have to use the Ascii code to trap the particular key pressed.



I don't know if I'm of any help here, but it's helping me learn it myself. Of course, the above code needs to be part of some function in ActionScript.

Good luck.

OK we're getting somewhere, that looks similar to the code i've been trying.
A couple questions:
Does this code go into the scene action script, or in the script for each button?
for:

sndWakawaka.attachSound("waka.wav"); // Connect the Sound object to the file in the Library. The text inside the "" is the name of the audio element in the Library (NOT the filename of a particular file).

This is what's confusing me.
Say we're working with the car crash sound. In the library it's named car_crash.mp3, which is the same as the file name. So am I safe to assume we're going by it's library name and NOT the linkage identifier I gave it of "ccrash"?

Also, Key.isDown looks like it makes more sense than on (keyPress) which i've been using.

ImAlrightSpider
11-18-2006, 06:50 PM
All of the code should go in the ActionScript for the scene, not the button.


From what I understand of the way you are coding, in the attachSound line, you should write

ccrash.attachSound("car_crash.mp3");

sniper
11-18-2006, 11:52 PM
ccrash = new Sound();
ccrash.attachSound("car_crash.mp3");
if(Key.isDown(65)){
ccrash.start();
**


Still does nothing "whaa"
I also tried (61) for lowercase "a"