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

Stop one sound while another plays 2

Status
Not open for further replies.

BigBadDave

Programmer
May 31, 2001
1,069
EU
Ok, I have got 4 sound loops that I want to play one loop at a time, when I click another loop the current loop stops and the next loop plays, well I have got this bit sorted, but next I want to be able to play a further 3 sounds (these are not looped) when 1 of them plays it stops the other 2 from playing but doesn’t interfere with the current loop of the batch of 4 loops, because that is what is happening at the moment the first bit works fine but when I want to play 1 of the 3 sounds the currently playing loop of the batch of 4 loops stops.

I know this sounds quite complicated but basically what I am trying to do is create a DJ mixing application where you can mix in scratch effects etc but I don’t want the beat loop to stop.

From David Byng

davidbyng@hotmail.com

 
hi david

this shouldn't be happening, unless you're targetting is screwed or somehting, do you want to post the fla?

Have you tried putting your one-off sounds on buttons in the DOWN frame? I don't know how you have it set up at the minute so I may be repeating what you have already?

dave
dave@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^​
 
wow, I'm gonna have to walk away from this one I'm afraid. Someone with a faster connection is gonna have to take over, the FLA you posted is almost 7mB which to me equates to about 12 hours downloading time on my crap connection.

Sorry David

dave
dave@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^​
 
I have had a thought,

Here is the action script i use maybe there is a problem here:

s1 = new Sound();
s1.attachSound("beatsloop1.wav");
s2 = new Sound();
s2.attachSound("beatsloop2.wav");
s3 = new Sound();
s3.attachSound("beatsloop3.wav");
s4 = new Sound();
s4.attachSound("beatsloop4.wav");
s5 = new Sound();
s5.attachSound("startit.wav");
s6 = new Sound();
s6.attachSound("ripper.wav");
s7 = new Sound();
s7.attachSound("scratch.wav");


that is all on on layer across the whole movie

and here is the script for each button:

on (press) {
s5.stop();
s6.stop();
s7.stop();
gotoAndPlay (9);
}


maybe you can help from this
icon_smile.gif
 
ok, gimme a tick
dave@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^​
 
what's in frame9?
dave@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^​
 
on (press) {
s5.stop();
s6.stop();
s7.stop();
gotoAndPlay (9);
}


are these the actions on one of the buttons to select one of the loops?

What are the actions you are using to play one of the one-off sounds?

And what is at frame9 that you're telling your movie to goandplay?

dave
dave@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^​
 
Hi,

The beat loops are in frames 3, 5 and 7 and the scratch sounds are in 9, 11 and 13 each button has stop s5, s6 and s7 and then goto frame # 1 or 9 or 13
 
...eventually

Sound ain't my big thing, so here goes. I tested with 3 loops and 3 sounds.

Layer1 (actions/mc's), Frame1:
Create 3 movie-clips, no content, drag them onto main stage and gove instance names of: "loop1mc", "loop2mc", loop3mc"
Code:
s1 = new Sound();
s1.attachSound("loop1");
s2 = new Sound();
s2.attachSound("loop2");
s3 = new Sound();
s3.attachSound("loop3");
s4 = new Sound(_root.loop1mc);
s4.attachSound("sound1");
s5 = new Sound(_root.loop2mc);
s5.attachSound("sound2");
s6 = new Sound(_root.loop3mc);
s6.attachSound("sound3");

frames extended to entire length of movie.

Layer2 (stops/sounds),
Frame1: label "loop1"
Frame2: (stop action)sound loop1 inserted, linkage "loop1"
Frame3: label "loop2"
Frame4: (stop action)sound loop2 inserted, linkage "loop2"
Frame5: label "loop3"
Frame6: (stop action)sound loop3 inserted, linkage "loop3"

Layer3 (buttons),
Loop1-select-button actions:
Code:
on (release) {
    _root.gotoandplay("loop1");
    s3.stop();
    s2.stop();
}
Loop2-select-button actions:
Code:
on (release) {
    _root.gotoandplay("loop2");
    s1.stop();
    s3.stop();
}
Loop3-select-button actions:
Code:
on (release) {
    _root.gotoandplay("loop3");
    s1.stop();
    s2.stop();
}

Sound1-select-button actions:
Code:
on (release) {
    s4.start();
    s5.stop();
    s6.stop();
}

Sound2-select-button actions:
Code:
on (release) {
    s5.start();
    s4.stop();
    s6.stop();
}

Sound3-select-button actions:
Code:
on (release) {
    s6.start();
    s5.stop();
    s4.stop();
}

It all worked for me...

I've uploading the fla (500K) if this ain't too helpful.

(sample in action)
(zipped fla)

dave

ps: don't get too jealous about the sample sounds! I'll give you a good price if you want copies ;-)
dave@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^​
 
no probs, is it what your after?
dave@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^​
 
ps: are you gonna register with Tek-tips, the more the merrier ;-)
dave@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^​
 
Hi (again) Dave,

Here is my finished movie:


I have just one little thing with it, when you repeatedly click one of the effects e.g. scratch it plays several times in a stepped way is there anyway to make it like the beats where when u click them repeatedly they re-start not play over each other??

Cheers

David Byng
icon_smile.gif
 
Hi, again,

I've figured how to do it:

on (press) {
s4.stop();
s5.stop();
s6.stop();
}
on (release) {
s4.start();
}

Cheers

David Byng
icon_smile.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top