Be a Supporter!

(AS2) Sound Dissolve

  • 281 Views
  • 3 Replies
New Topic Respond to this Topic
CompleteDouche
CompleteDouche
  • Member since: Dec. 1, 2008
  • Offline.
Forum Stats
Member
Level 09
Musician
(AS2) Sound Dissolve 2010-03-06 16:11:16 Reply

So I have a movieclip that has two movieclips nested in it.
The first movieclip plays once, then the second one will loop infinitely.
When someone presses the play button, I want the sound volume to decrease no matter where or which song is playing. How can I do this?

I was thinking something like this:
(I know setVolume might not even exist, just a gist of what I want)

onEnterFrame=function(){
button.onRelease(){
 setVolume(100);
volume -=3;
if(volume == 0){nextFrame}}}

No matter what your weaknesses are, make sure your own abilities supersede them.

Treerung
Treerung
  • Member since: Apr. 18, 2008
  • Offline.
Forum Stats
Member
Level 11
Blank Slate
Response to (AS2) Sound Dissolve 2010-03-06 19:08:19 Reply

You have the right idea but after importing the sound to library you want to right-click your sound in the library and select linkage.
Click "Export for Actionscript" and "Export in First Frame" and then in the identifier box put "song1".
Then in the frames action panel put:

level=100;
clicked=false
newSound=new Sound(this);
newSound.attachSound("song1");
newSound.start(0,99);
onEnterFrame=function()
{
newSound.setVolume(level);
if(clicked==true&&level>=0)
{
	level-=3;
	
}
}
button.onRelease=function()
{
	clicked=true;
}

You might have adjust this code a little since you used nested movieclips.


:'(

BBS Signature
Treerung
Treerung
  • Member since: Apr. 18, 2008
  • Offline.
Forum Stats
Member
Level 11
Blank Slate
Response to (AS2) Sound Dissolve 2010-03-06 19:17:05 Reply

I should add that for your particular problem you should incorporate a for loop to account for multiple songs.
Just give each song and identifier of "song1","song2" etc..

for(i=0;i<10;i++)
{
newSound=new Sound(this);
newSound.attachSound(["song"+i]);
}

You also must specify which song actually playing at which time with:

newSound.attachSound("song1");

:'(

BBS Signature
CompleteDouche
CompleteDouche
  • Member since: Dec. 1, 2008
  • Offline.
Forum Stats
Member
Level 09
Musician
Response to (AS2) Sound Dissolve 2010-03-06 22:01:29 Reply

Problem is, that I can't use actionscript to loop the songs because there gap between the song looping doesn't give the effect I want.


No matter what your weaknesses are, make sure your own abilities supersede them.