Making a sound loop?

Hello Everyone,

I have a script on a button…
When I rollOver, the sound starts.
When I rollOut, the sound stops.

But what could I add to make the
sound loop until I rollOut?

Here’s the script on my button…


on (rollOver) {
myMusic = new Sound(this);
myMusic.attachSound(“sound_effect”);
myMusic.start();
}

on (rollOut) {
myMusic.stop();
}


Thanks!
Neuhaus3000

add the loop parameter in this line:

myMusic.start(secondsoffset, loop);

something like

myMusic.start(0, 999);

would do :slight_smile:

Dude, your fast !

Thanks… I will try this.
I’m sure it will work !

Have a nice day! :beam:

Neuhaus3000

no problem neuhaus =)

and nice day to you too :wink:

Works fine for the looping ! =)

But on rollout, it doesn’t stop… :x

Is this code ok ? I think so…

on (rollOut) {
myMusic.stop();
}

I also noticed that when I use
actionScript to open a sound,
It appears louder !.. What the ?!? :angry:

Neuhaus3000

:stunned:

can you attach your fla ?

and if you don’t want it that louder …

myMusic.setVolume(volume);

Hey Kax,

Attach my fla ?

I can attach the sound symbol from the library.
But I can’t make it stop with this script :

on (rollOut) {
myMusic.stop();
}

Thanks for the volume script! :beam:

Neuhaus3000

:stuck_out_tongue:

attach your fla file in your post :wink:

i don’t know why it’s not working … that’s why i’d like to see your file :slight_smile:

u can try
myMusic.stop(“sound_effect”);

Hey Eudora, thanks for the tip! :smirk:
This is logical and it should work…
but it doesn’t :-\

The volume doesn’t work either. :sleep:

This is what I’ve got :


on (rollOver) {
myMusic = new Sound(this);
myMusic.attachSound(“sound_effect”);
myMusic.start(0, 999);
myMusic.setVolume(50);
}

on (rollOut) {
myMusic.stop(“sound_effect”);
}


Man, I tell ya… :sigh: Everything seems to be
in the right place.

Any clue ? I will make some more tests tonight. :hangover:

Thank you all !!!
Neuhaus3000

on (rollOver) {
	myMusic = new Sound(this);
	myMusic.attachSound("sound_effect");
	myMusic.setVolume(50);
	myMusic.start(0, 999);
}
on (rollOut) {
	myMusic.stop();
}

weird … i just tested it and everything worked perfectly :-\

It worked! :crazy:

I ajusted a couple of things…

  • Deleted the audio in my “Over” button state (settled the volume problem); :sigh:
  • Disabled the linkage “add in 1st frame” and added the sounds in blank frames (settled the long 1 frame downloading); :stuck_out_tongue:

Many Thanks !!! :slight_smile:

Neuhaus3000

code:

on (rollOver) {
myMusic = new Sound(this);
myMusic.attachSound(“sound_effect”);
myMusic.setVolume(50);
myMusic.start(0, 999);
}
on (rollOut) {
myMusic.stop();
}

no problem neuhaus =)

glad it worked :slight_smile: :wink:

:slight_smile:

I have on other bug that I can’t quite get an answer…

I’m loading a movie above an other one
but the the buttons on the movie underneath
are still active. Do you know how to disable them?
:crazy:

Thanks!

Neuhaus3000

<a href=“http://www.kirupaforum.com/search.php?s=”>
<img border=“0” src=“http://www.kirupaforum.com/images/search_top.gif” width=“56” height=“18”></a> :wink:

MovieClip.prototype.enable = function(action) {
	for (k in this) {
		this[k].enabled = action;
	}
}
// to enable
instance.enable(true);
// to disable
instance.enable(false);

instance can be a movie clip if you’re loading into target or a level :slight_smile:

btuttonname.enabled=false

Grim

Hey Kax,

Wooooohooo ! =)

But I can’t quite seem to know how to add the script
to my movie… :nerd:

I have a main movie (level0) that loads a movie on level 1.
On my level 1, I have a button that loads a movie
on level 2.

I want to disable only my buttons on level 1
when the movie on level 2 has loaded and
when I unload the movie on level 2, I want
my buttons to be enabled again :crazy:

Structure

Level_0 (main movie)
|
Level_1 (movie where my buttons are and should be disabled)
|
Level_2 (when I unload this movie, I should enable
my buttons on level_1 again)


So I have to add the script where exactly ? ;(

Thanks a million !!! :slight_smile:
Neuhaus3000

you would have

_level1.enable(false);

in the first frame of the movie loaded at level 2

when you unload the movie just use

_level1.enable(true);

and your buttons will recover its functionality :slight_smile:

And …

MovieClip.prototype.enable = function(action) {
for (k in this) {
this[k].enabled = action;
}
}

…would go on the button that calls the movie on level2… right?

It would look like :

on (release) {
MovieClip.prototype.enable = function(action) {
for (k in this) {
this[k].enabled = action;
}
}
}

Neuhaus3000

sorry … i should have told you before

place it in the timeline :slight_smile: