-
[MX] sound stop then play problem
it doesn't start playing angain
Code:
onClipEvent (enterFrame) {
stopAllSounds();
}
on (keyPress "<Space>") {
_root.snd.start(0, 10);
play();
}
-
Musical chair
It's probably because your onEnterFrame stops the sound every frame, so, even if one presses space, if will have stopped already. Also, (((((on (keyPress) "<Space>") {))))) I'm pretty sure, like, doesn't work, for the most part. Try this...
Code:
onClipEvent(enterFrame){
if (_currentframe==(SOMETHINGGOESHERE)){
stopAllSounds();
}
onClipEvent(keyDown){
if (Key.isDown(32)){
_root.snd.start(0, 10);
play();
}
}
-
it didn't work, I got an error that I can't have on handelers inside other on handelers. Also I replaced your text something goes here,with 128. adn only your words not any of the symbols. is that right??
-
Musical chair
Did you make sure my code was the ONLY code on your movie clip?
-
yes here is the code
Code:
onClipEvent(enterFrame){
if (_currentframe==(128)){
stopAllSounds();
}
onClipEvent(keyDown){
if (Key.isDown(32)){
_root.snd.start(0, 10);
play();
}
}
-
Musical chair
Sorry, by (SOMETHINGGOESHERE), I meant without the parenthesis.
-
i got this as an error message
**Error** Scene=Scene 1, layer=Layer 1, frame=128:Line 5: onClipEvent handlers may not nest within other onClipEvent handlers
onClipEvent(keyDown){
**Error** Scene=Scene 1, layer=Layer 1, frame=128:Line 1: Statement block must be terminated by '}'
onClipEvent(enterFrame){
**Error** Scene=Scene 1, layer=Layer 1, frame=128:Line 10: Syntax error.
}
Total ActionScript Errors: 3 Reported Errors: 3
-
Musical chair
sorry, missed ANOTHER parenthesis
[code]onClipEvent(enterFrame){
if (_currentframe==(128)){
stopAllSounds();
}
}
onClipEvent(keyDown){
if (Key.isDown(32)){
_root.snd.start(0, 10);
play();
}
}
-
Musical chair
Code:
onClipEvent(enterFrame){
if (_currentframe==(128)){
stopAllSounds();
}
}
onClipEvent(keyDown){
if (Key.isDown(32)){
_root.snd.start(0, 10);
play();
}
}
-
i didn't get an error message, but unfortunately it didn't stop the sounds
-
Musical chair
WHEN do you want the sounds to stop? Because that sound stops on frame 128.
-
not with the last code you provided, it just keeps playing, it doesn't stop. The sound I want to stop is the same one that I want to start in the end of that code piece
-
Musical chair
Strange... Try this?
Code:
onClipEvent(enterFrame){
if (_currentframe==(128)){
stopAllSounds();
}
}
onClipEvent(keyDown){
if (Key.isDown(32)){
_root.snd.start(0, 10);
play();
}
}
-
Musical chair
Oops, ignore my last post...
Code:
onClipEvent(enterFrame){
if (_currentframe==(128)){
_root.snd.stop();
}
}
onClipEvent(keyDown){
if (Key.isDown(32)){
_root.snd.start(0, 10);
play();
}
}
-
Musical chair
By the way, how many frames long is the layer you are putting this code on?
-
still didn't work. 539.
this is on a movie clip that I have copy and pasted the frames for like 12 times
-
i only have two frames. one, the movie, and another one, buttons ect.
-
Musical chair
So, on the top layer, there are 2 frames, and on the movie, located on the top layer, there are 539 frames? Is this right?
-
Musical chair
You still haven't answered my question...
Originally Posted by sumwungye
WHEN do you want the sounds to stop?
On the click of a button? When you get to a certain frame? Et cetera...
-
Musical chair
Try this...
First give your movie clip instance name "movieclip", then add this code to it...
Code:
onClipEvent(enterFrame){
if (_root.movieclip._currentframe==128){
_root.snd.stop();
}
}
onClipEvent(keyDown){
if (Key.isDown(32)){
_root.snd.start(0, 10);
play();
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|