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

Two Questions Regarding Soundboards

Status
Not open for further replies.

MonkeyBeard

Technical User
Dec 9, 2004
23
US
I'm relatively new to Flash and I'm putting together a soundboard. I have two questions:

1) When a sound is playing, if I press the button again, the sounds will overlap (the first sound is still playing as the second sound begins playing). How can I get it so that pressing the button starts the sound from the beginning again, without continuing to play through the first?

2) How can I assign keys to play sounds? For example, instead of having to drag the cursor over a button a click it, I just hit "2" on the keyboard and it plays.

Thanks very much ahead of time for your help.
 
1) do:
soundName.stop()

then:

soundName.start();

2) on(keyPress "2") {

[conehead]
 
I selected the keyframe and pasted those into the Actions panel and neither seem to work. I'm getting an output error message.
 
put #1 the same place you are playing the sound, just stop it before you play it... #2 should go on the button but could be done on the root as well you would just need to place it within a function()

[conehead]
 
When I try to put actions on the button is tells me "Current selection cannot have actions applied to it.
 
Okay, to make things easier, I've posted the flash document on my iDisk. Obviously the sound will not work because it's just the flash document. but if someone could take a look at it and tell me what the problem is that would be amazing. The current file has NO actionscripts anywhere. It's simply the button. Thanks.
 
No, that already works. But say I click the button twice, it plays the sound twice, overlapping. It will continue playing it the first time, while playing the second time. I want it so that the second click stops the first play and plays the sound again from the begining.
 
ok here you go:

1. take the sound off from within your button
2. right click the sound in your library and select Linkage
3. Select "Export for ActionScript"
4. Give the sound a name at the top of this window and close it
5. Go back to the main screen and create a new layer called actions. Click on frame 1 and open your actions screen and type:

Code:
crash = new Sound();
crash.attachSound("Whatever You named the file inLinkage");

6. Go back to the main stage and click on the button
7. Open your actions screen and put:

Code:
on (release) {
    crash.stop();
    crash.play();
}

[conehead]
 
Still getting an output error and the sound doesn't play at all.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top