# Need Help With AS & Sound In A BIG Way

**URL:** <https://forum.kirupa.com/t/need-help-with-as-sound-in-a-big-way/33166>\
**Category:** flash\
**Created:** [October 15, 2003, 10:47pm UTC](https://forum.kirupa.com/t/need-help-with-as-sound-in-a-big-way/33166 "2003-10-15T22:47:40Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![macmar](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@macmar](https://forum.kirupa.com/u/macmar)\
**Post date:** [October 15, 2003, 10:47pm UTC](https://forum.kirupa.com/t/need-help-with-as-sound-in-a-big-way/33166/1 "2003-10-15T22:47:40Z")

</div>

I’ve tried and tried, and can’t get this puppy to stop the way it should. I’m about ready for the funny farm on this. I’m dumb as dirt with AS. Help is needed and would be appreciated a lot!  
My mp3 file/“myMuzak” is intended as background music at all levels EXCEPT Level 120.  
I’m using loadMovieNum() to create the entire web site:  
Level 0 - Main/root level where the vol. slider & AS reside.  
Level 10  
Level 20  
Level 30 - 2 scenes  
Level 50 - 2 scenes  
Level 70  
Level 80 - 2 scenes, 1st scene has an event sound on stage that plays ONLY in  
this scene WITH “myMuzak.”  
Level 100  
Level 120 - Video with sound-I need the “myMuzak” OFF HERE.  
Level 140

The only way I can get “myMuzak” to stop is by using “stopAllSounds” at level 120. The upside to this is that the vol. slider then controls the Video sound (something I never expected but like). The BIG downside, of course, when any button is used to go to any level now there’s no more background music.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 19, 2003, 7:12am UTC](https://forum.kirupa.com/t/need-help-with-as-sound-in-a-big-way/33166/2 "2003-10-19T07:12:37Z")

</div>

I posted this:

```auto

myMusic = new Sound(this);
myMusic.attachSound("myMusic01");
myMusicVolume=100;
myMusic.setVolume(myMusicVolume);
// on level 120, use
_level0.myMusic.stop();

```

and the post after that, you said it stopped at the beginning. So I figured you copied and pasted the code, but the \_level0.myMusic.stop() was just an example of a stop action. That shouldn’t have stood there. So I said: change the stop in that line to start(0,999), so it would autoplay as you wanted. So it’ll become this:

```auto

myMusic = new Sound(this);
myMusic.attachSound("myMusic01");
myMusicVolume=100;
myMusic.setVolume(myMusicVolume);
myMusic.start(0,999);

```

Then, after that, you posted the code on your buttons. But each button was using it’s own variable, which is probably why you had to click stop first and then play again. Therefore, they all use the same variables located in \_root. But, before they cna use them, we must set them initially. And since I just added the autoplay, I added these three lines to set the initial values to playing = true, paused = false and stopped = false. Since these are on the main timeline already, we don’t have to use \_root anymore, but the code on the buttons do because they are not on the main timeline.

```auto

playing = true;
paused = false;
stopped = false;

```

So: the code you should try is the one in my previous post. Sorry if I confused you.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 19, 2003, 2:25pm UTC](https://forum.kirupa.com/t/need-help-with-as-sound-in-a-big-way/33166/3 "2003-10-19T14:25:48Z")

</div>

BINGO! It works, lol–you are a sound guru!..THANKS (I wish there was a way to reward you for sticking it out with me on this) just doesn’t seem adequate. There IS a wealth of info in the Kenny Bellew tuts; however, his //comments could be reworked/better for AS novices like me  
On Level 120 in my Video MC I put \_level0.myMusic.stop();, after it plays I put \_level0.myMusic.start(). With the last button scripts & AS on frame in main you supplied it works perfectly. Except–and I hope I’m not pushing my luck here–but is there script that could be added to the Level 120 scripts \_level0.myMusic.stop(); and \_level0.myMusic.start() to fade the music out on stop and fade the music in on start?  
Thank you again, never would have come up with all that revised script in a jillion years.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 19, 2003, 2:44pm UTC](https://forum.kirupa.com/t/need-help-with-as-sound-in-a-big-way/33166/4 "2003-10-19T14:44:01Z")

</div>

How is your Video MC set up ? Like: a start sound action at the first frame, a stop sound action on the last frame. So you want the sound to fade in instead of just play and fade out instead of stop ? That can be done perfectly 🙂

Let me see if I get you straight though: There’s like a background sound for the Video MC, and you want to be able to stop and play it. Ok, but that sound seems to be looping. So I conclude that you have a loop which you want to play along with the video. But you want it to fade in and fade out. Correct ?

But there’s one thing that confuses me: you said you have a sound play action on the first frame of your video mc (well, that’s what I make of it at least :P), but you also wanted it to autostart. Your play action in the first frame should autostart it. That’s what I’m confused about, you want to autostart it twice ?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 19, 2003, 7:39pm UTC](https://forum.kirupa.com/t/need-help-with-as-sound-in-a-big-way/33166/5 "2003-10-19T19:39:46Z")

</div>

Sorry to leave you hanging there. I got unexpected guests. These layouts get a little hard and confusing to describe. A picture’s worth a lotta’ words…take a look at the attached–I think it will show you better than I could explain. Not confident that what I want is doable in a frame action. Thank you.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 19, 2003, 8:16pm UTC](https://forum.kirupa.com/t/need-help-with-as-sound-in-a-big-way/33166/6 "2003-10-19T20:16:18Z")

</div>

That image was … [size=1]quite confusing.[/size]

I can’t make anything out of that image. You want it to fade out at frame 80 and fade in at … 102 ? You want to fade it out before it has started ?? Please tell me exactly what you are trying to achieve and what the situation is now. Take your time, explain everything 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 19, 2003, 9:38pm UTC](https://forum.kirupa.com/t/need-help-with-as-sound-in-a-big-way/33166/7 "2003-10-19T21:38:16Z")

</div>

Sorry 'bout the image…thought it would be easier for you.

1. My mc video plays immediately upon entering Level 120. It plays to frame 80 which has\> stop(); AS. (The 1st 80 frames are a brief intro the actual video itself). At this point the viewer uses the Start button (located on main stage which has AS\>on (release) {  
bluvideo.play();  
}  
There’s also a stop button.
2. Frame 81 has \>-level0.myMusic.stop(); AS. It is HERE in this frame, in this AS that I would like to FADE OUT the background/“myMusic.”
3. Upon use of the start button my intro fades out and the actual video with it’s streaming music starts at Frame 96 and ends at Frame 996 Graphics fade out to Frame 1034 which has\>\_level0.myMusic.start(); AS. It is HERE in this frame, in this AS that I would like to FADE IN the background/“myMusic.”
4. Frame 1035 has\>gotoAndStop(80); AS. The viewer now may restart the video (with the start button on main stage) & play it again or go somewhere else.

I think that’s more than you need/want to know. I Would like the "myMusic to fade out at Frame 81, and fade in at Frame 1034.  
NOTE: I did find that after the above scenario plays through once and the playhead returns to Frame 80, the “myMusic” only plays one loop then stops. It’s not a big deal because the loop is a fairly long one, and a viewer probably wouldn’t just sit there looking at the screen for very long. But, if there’s a way to rectify that I would like to.  
Thank you for your patience, generosity, and help.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 20, 2003, 5:27pm UTC](https://forum.kirupa.com/t/need-help-with-as-sound-in-a-big-way/33166/8 "2003-10-20T17:27:47Z")

</div>

Ah ok, I think I understand. Ok, so instead of using the \_root.myMusic.stop() action, use this:

```auto

speed=1;
_root.onEnterFrame = function(){
this.myMusicVolume-=speed
this.myMusic.setVolume(this.myMusicVolume);
if(this.myMusicVolume <= 0){
this.myMusic.stop();
delete this.onEnterFrame;
}
}

```

And this for the fade in:

```auto

speed=1;
_root.myMusic.start(0,999);
_root.onEnterFrame = function(){
this.myMusicVolume+=speed
this.myMusic.setVolume(this.myMusicVolume);
if(this.myMusicVolume >= 100){
delete this.onEnterFrame;
}
}

```

🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 20, 2003, 7:47pm UTC](https://forum.kirupa.com/t/need-help-with-as-sound-in-a-big-way/33166/9 "2003-10-20T19:47:03Z")

</div>

Good day, Voetsjoeba,  
Hmmm, I copied & pasted the new AS and it doesn’t work. The music does not fade out, NOR does it stop. (The music plays over itself when the end of the loop is reached-2 going at once) I put \_level0.myMusic.stop(); AS back in Frame 81 to try it with the fade in script and that fade in script doesn’t fade it in OR start the music that way either. Sorry, but you tried–your efforts are greatly appreciated.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 21, 2003, 5:04pm UTC](https://forum.kirupa.com/t/need-help-with-as-sound-in-a-big-way/33166/10 "2003-10-21T17:04:32Z")

</div>

Well I tested it and it definately works, but maybe it doesn’t in your setup. Can I see the FLA, so I know what your structure is ? That’ll make it a lot easier for me to code.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 21, 2003, 7:47pm UTC](https://forum.kirupa.com/t/need-help-with-as-sound-in-a-big-way/33166/11 "2003-10-21T19:47:28Z")

</div>

Well, I would really like to send it to you, but it’s too big to attach (10.6 MB, zipped). I’ve cut the stage size way down and thrown out all the buttons and graphics that aren’t essential from the library. I even took out the .flv video file…and that didn’t take the size down…weird, because the video file is 5.6 MB–I take it out–the fla. doesn’t decrease by 5.6 MB. In fact, my original .fla and the one I threw everything out of both show 12.1 MB unzipped. I’m totally mystified ??? The only thing I can think of is the MC you want to see is 1035 frames long, maybe that’s why it’s so large. My e-mail is Yahoo (free) so no go there either. Do you have FTP?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 22, 2003, 10:34am UTC](https://forum.kirupa.com/t/need-help-with-as-sound-in-a-big-way/33166/12 "2003-10-22T10:34:55Z")

</div>

Yes I do 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 22, 2003, 11:37am UTC](https://forum.kirupa.com/t/need-help-with-as-sound-in-a-big-way/33166/13 "2003-10-22T11:37:51Z")

</div>

Can I e-mail you?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 22, 2003, 1:11pm UTC](https://forum.kirupa.com/t/need-help-with-as-sound-in-a-big-way/33166/14 "2003-10-22T13:11:07Z")

</div>

Sure you can, voetsjoeba at [hotmail.com](http://hotmail.com)
