Another sound issue. HELP!

  • CHEVALIER
  • Born
  • Born
  • CHEVALIER
  • Posts: 4

Post 3+ Months Ago

Hello everyone.

I'm working on a presentation with a menu and 6 "chapters", that will be loaded to the main stage using LoadMovie.

In the main timeline, I'm using this on/off sound button, with this code in a MC right next to it:

Code: [ Select ]
onClipEvent (load)
{
  _root.soundstatus = "on";
  _root.mySound = new Sound(_level1);
  maxvolume = 100;
  minvolume = 0;
}
onClipEvent (enterFrame)
{
  if (_root.soundstatus == "on")
  {
    step = 5;
  } // end if
  if (_root.soundstatus == "off")
  {
    step = -5;
  } // end if
  maxvolume = maxvolume + step;
  if (maxvolume > 100)
  {
    maxvolume = 100;
  } // end if
  if (maxvolume < 0)
  {
    maxvolume = 0;
  } // end if
  _root.mySound.setVolume(maxvolume);
}
  1. onClipEvent (load)
  2. {
  3.   _root.soundstatus = "on";
  4.   _root.mySound = new Sound(_level1);
  5.   maxvolume = 100;
  6.   minvolume = 0;
  7. }
  8. onClipEvent (enterFrame)
  9. {
  10.   if (_root.soundstatus == "on")
  11.   {
  12.     step = 5;
  13.   } // end if
  14.   if (_root.soundstatus == "off")
  15.   {
  16.     step = -5;
  17.   } // end if
  18.   maxvolume = maxvolume + step;
  19.   if (maxvolume > 100)
  20.   {
  21.     maxvolume = 100;
  22.   } // end if
  23.   if (maxvolume < 0)
  24.   {
  25.     maxvolume = 0;
  26.   } // end if
  27.   _root.mySound.setVolume(maxvolume);
  28. }


The button has this code:

Code: [ Select ]
on (release)
{
  gotoAndPlay(2);
}
on (release)
{
  _root.soundstatus = "off";
}
on (release)
{
  _root.d01.gotoAndStop(1);
  _root.d02.gotoAndStop(1);
}
  1. on (release)
  2. {
  3.   gotoAndPlay(2);
  4. }
  5. on (release)
  6. {
  7.   _root.soundstatus = "off";
  8. }
  9. on (release)
  10. {
  11.   _root.d01.gotoAndStop(1);
  12.   _root.d02.gotoAndStop(1);
  13. }


This button works fine, and I plan to leave it over all the other elements.

The problem is: In the external swfs, there are other sounds playing, but this button only turns the sound in the main timeline off.

The sounds in the others swfs are attached like this:

Code: [ Select ]
var loc03:Sound = new Sound();
loc03 = new Sound(soundon);
loc03.attachSound("loc03");
loc03.start(0,1);
  1. var loc03:Sound = new Sound();
  2. loc03 = new Sound(soundon);
  3. loc03.attachSound("loc03");
  4. loc03.start(0,1);


and in the swfs there is a button to stop the sound playing in it and return to the main timeline:

Code: [ Select ]
on (release){
    loc03.stop();
    _root.gotoAndPlay("menu");
}
  1. on (release){
  2.     loc03.stop();
  3.     _root.gotoAndPlay("menu");
  4. }


How can I make the on/off button in the main timeline turn off the sounds in the loaded swfs as well?

Thanks a lot!
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

first of all, why you use 3 times the on (release) function?
wouldn't it be easier to use it once and have all the code inside?
Code: [ Select ]
on (release)
{
  gotoAndPlay(2);

  _root.soundstatus = "off";

  _root.d01.gotoAndStop(1);
  _root.d02.gotoAndStop(1);
}
  1. on (release)
  2. {
  3.   gotoAndPlay(2);
  4.   _root.soundstatus = "off";
  5.   _root.d01.gotoAndStop(1);
  6.   _root.d02.gotoAndStop(1);
  7. }


About the button thing:
Set the instance name of the movie in which you load the swf to whateve name you want, i will name it here: loadedMC
then, in your button from the main timeline, after the line: _root.mySound.setVolume(maxvolume);
add: _root.loadedMC.loc03.setVolume(maxvolume);

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 15 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.