Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Sound Toggle Between On And Off



hi

I have created a MC and an invisible button

1.In MC I placed button.
2. frame 1 _root.sound=1;
3. In MC
OnClipEvent(EnterFrame){
if (_root.sound==0){
stopAllSounds()
}
else
_root.a.play();//where a is MC
}

4.In Button
on (release) {
if (_root.sound==0){
_root.sound=1;
}
else if (_root.sound==1){
_root.sound=0;
}
}



FlashKit > Flash Help > Flash ActionScript
Posted on: 09-07-2001, 08:12 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

>> Sound On/off Toggle
i'm trying to make a toggle switch (not volume control) for the sound loop in my movie...
here's what i've got so far:
- - - - - - - - - - - - - - - - - - - - - - - - -
on (release) {
if (soundOn.music<1) {
_root.flick.gotoAndPlay("flickers");
soundOn.music = soundOn.music+1;
soundOn.soundback.gotoAndStop(1);
stopAllSounds ();
soundOn.gotoAndPlay(2);
} else {
_root.flick.gotoAndPlay("flickers");

soundOn.soundBack.gotoAndPlay("loop");
}
}

- - - - - - - - - - - - - - - - - - - - - - - - -
this will turn the sound off okay... and will toggle it back on again when pressed... but i cannot get the sound to turn off again after that. it just drops the sound loop over and over again (on top of itself) creating a virtual trainwreck of a drumloop.

any suggestions?
thanks...
.andy

Sound Toggle
I am having a really hard time finding out how to create a sound toggle button in Flash 5. I created one that was a two frame movie clip. It works well until I click a button I have given a 'goToandPlay" previous frame action (my site is a small personal portfolio that works on a frame by frame basis instead of tell target). Can someone please help me? Thank you in advance.

Dave

Sound Toggle
I have a Flash movie that begins with music playing and looping every 10 -15 seconds on the main timeline. I want to create a button that will turn off/on the music on the main timeline (scene 1) without affecting the other scenes. The tricky part is that the music is on its own layer on the main timeline, and is not contained inside the button I created.

So far, I've been able to create the button that turns off the music, but when I click the button again, I cannot figure out how to get the music to play again.

Please help...

T.

Sound Toggle
For the love of God, somebody please help me with this! I was advised from an earlier post to do a set volume action to create my sound toggle. In other words, pressing the button once will play the clip at full volume, pressing it again will play the clip at no volume. How exactly do I do that? I'm a newbie...

Thank you and Regards,

rheingold

Toggle Sound On And Off
Hello:
I would like to create a button that would toggle sound on and off, but when I press the button the sound would fade out and press it again would fade in.
Thanks in advance for anyone who replies.

Sound Toggle
I need help. How do you make an on and off switch for the sound in your movie? I know how to make the buttons but I don't know the actionscript. Also where would you put the sound? Would the sound go in the same movie clip as the on and off switch or a separate scene or a whole seperate file altogether? Thanks

Toggle Sound
Hi,

I have 2 buttons that stop or start a sound,

On release mysound.start(0,1)

and on the other button

On release mysound.stop()

Works fine, however I only want 1 button that toggles the sound on and off,

I cant seem to find a simple piece of code for this,

Cheers

Sound Efx/ Toggle Off
Hi,
Is there a way I can have an on/off switch for sound efx? I have created buttons that turn off music tracks and such, but I would need code to tell the sound effect that I have in the down state for each of my buttons to be silent upon hitting the "sound off" button. Is there a way to do this?

Thanks in advance,
Mike

Sound Toggle
I have background audio loaded as a sound object, referencing an empty movie clip. I have a toggle button controlling volume fade up and down. I also have navigation buttons that fade the volume of the sound object down with the same code as the toggle button. When the movie loads, the sound plays and the toggle functions. When the navigation button is pressed it also works, but I can't get the sound to restore, even though no stop command has been triggered.

Any ideas? What I want to happen is this: Song plays, toggle button allows user to turn down volume to off, navigation button turns volume on song down while viewing a page. Upon hitting an "exit" button, a new song will play in the background, and the toggle button will function as before, until a new navigation button is pressed.

Sound Toggle
I would like to create a button that
1. If sound is playing in background, it will stop the sound.
2. If there is no sound playing in the background, it will start playing the sound.

Basically a mute button, but for all sounds playing.

Any help is greatly appreciated. Thanks.

Sound Toggle On/Off
Hi

Ok i'll try not to confuse anyone with what im gonna ask so here goes.

Ive got a button on a layer called 'toggle' that allows me to turn some music on and off - the music is in a sepearte movieclip called 'soundtrack' on a layer called 'soundtrack - and it works fine.

However if i turn it off, it begins to play again after one of the movieclips called 'background' within the site loops??

Below is the ActionScript im using on the button to control the music:

on (release) {
if (music == true) {
music = false;
stopAllSounds();
} else if (music == false) {
music = true;
Soundtrack.gotoAndPlay(1);
}
}

I cant understand why it begins to play again after i've turned it off? any help with this would be greatly appreciated!!

also i have a layer named actions that initialises the load sequence to the whole flash movie that has the script:

music = true

again if anyone can help its appreciated

THANX

Ben.

Sound On/off Toggle
Could someone tell me why this doesn't work?
I'm combining a couple different ideas from Kirupa tutorials and Flashkit movies.

Basically, its just two buttons (on, off). One in frame 1 and one in frame two of the timeline. I've attached AS to frame 1 to load and start the music. I've attached AS to each button to "supposedly" control its "onrelease" action.

The load and start sound works fine, but the buttons don't seem to have any effect.

Here's the fla. I used a Buffy The Vampire Killer sound clip to keep the fla small for sake of file transfer.

Sound On/Off Toggle
I need to create an on/off button that will turn the sound on/off in a flash movie. My sticking point is that the sound in question has to be synced up with specific events in the movie. It's not simply a background loop. Any idea how I should accomplish this.

Button Sound Toggle
I've posted this one before - hoping you can help this time

Can anyone explain to me a way to turn ALL my BUTTON sounds off using one toggle button?

I know how to control a sound object playing a background sound.... but what about the sounds which exist in the rollover and hit frames of my buttons???

I tried to dump all of the rollover sounds into a single clip - and play the relevent sound via an actionscript goto line. HOWEVER - it causes jumps and pauses in my menu animation. So... how the hell do I control the volume of these sounds?

Why the f**ck isn't there a universal volume control in Actionscript?????? And if there is, where the hell is it?.. and can you show me the way to a tutorial or open source fla so I can work it out? The only thing I can find is: stopAllSounds (); But, what about starting them again????

I've found squillions of tutorials about controlling sound... but not a single one which explains how to place and control button sounds. All the tutorials I've seen just blabber on about controlling a background sound (which is an easy one to solve) For some reason, it's going right over my head - but I bet it's as easy as hell once ya know how!! *LOL*

I'm stumped... can anyone help??


cheers.

Actionscript: Toggle Sound On/Off ?
Is there a Toggle Script for a sound button?

Example:
Say I have an MC on Level 3 with 2 frame labels, PLAY & STOP.

I have a button on Level 1 that I want to toggle between those 2 labels everytime the button is clicked on.

Basically, I guess I'm looking for an IF/THEN statement to make this happen on one button instance if possible.

Or is there a STOP ALL SOUNDS toggle script? cause that would be even easier. You guys are the bestest!

Tone.

Toggle Sound With One Button
Hey guys,
ive gone through the tutorials and everything, however, i could not find one that came to my specific needs. My flash movie has sound. it plays throughout the entire movie including each scene. however, im looking to make a toggle button to stop the music when they click it, and then if they want it on, click it again and the music will start again. I've thought of muting it, but then i cant restart the music when they want to hear it again. any suggestions?

Sound Toggle Flash5
There has to be a simple way to toggle sound on/off from a single button..
what am I doing wrong?

on (release) {
if (musicon="1") {
music1.stop();
musicon="0";

}

else {
music1.start();
musicon = "1";
}
}

Thank you.

Toggle Buttons For Sound
I am trying to have my movie have music that a viewer can turn off if they want with a button. I've tried creating a seperate sound.swf file and targeting it, but I can't get in Flash 5 how to put in "end tell target" and "end on". My action scripting looks like this:
On (Release)
Begin Tell Target ("_leve 1100")
Go to and Play ("Music Start")
Then I should have
"End Tell Target"
"End"

right?

If I don't have those End parts is that why it's not working? How do I get "End" in Flash 5? Or do I use "With"? I just need my viewer to be able to turn the music off if they want, nothing fancy. Any help would be much appreciated..

Sound Toggle Button
I have a large training piece that is broken up into sections. Each section has it's own soundbyte. I'm wondering if there is an easy way to have a sound toggle button allowing users to turn the soundbytes on/off. Any ideas on how to code this?

Need Simple Toggle Sound On And Off Tut
I have been trying to find a simple tutorial to toggle background sound on and off tutorial.. All I need is a button to turn it off and on.. thanks

:(simple Sound On Off Toggle
I've been searching and searching for this simple solution to my problem for so long i think my face has actually turned blue.

I want actionscript for my single button on my stage that will turn off and on my sound object thats on scene 1 from any scene!

Code:
var mySound = new Sound(this);
mySound.attachSound("song1");
mySound.start(0,999);
please please help me!!!

Sound ON/OFF Toggle Button
i have two buttons, on and off.. in my movie.. when the user enters the sound is on, when the user releases off button, i want ALL the sounds in my movie to be turned off..

how do i do this with my previous code. The code i pasted here works for the rollover, rollout, release, just not the sound.. i should mention that i used this code to create my sounds...

var mySound:Sound = new Sound();

//whichSound:String is the linkage name of my sounds from the library)
function playSound(whichSound:String) {
}

//here is an example of a sound that i need to call from the timeline
function transitionSound() {
_level0.playSound();
mySound.attachSound("transition");
mySound.start();
}


heres my on/off code:

function initSoundButton(obj:MovieClip) {

var lastClicked:MovieClip;
var soundArray:Array = new Array();

soundArray.push("onButton");
soundArray.push("offButton");

// Loop through state button array & initialize handlers
for (var i = 0; i < soundArray.length; i++){

var curBtn:MovieClip = obj.soundButton[soundArray[i]];

//trace("current button" + curBtn);
//trace("OBJ sound button " + obj);

// Set default button
if (i == 0) {
curBtn.select = true;
lastClicked = curBtn;
curBtn.gotoAndStop("released");
} else {
curBtn.over = false;
curBtn.select = false;
}

curBtn.onRollOver = function() {
//trace("THIS " + this);
if (this.over) {
this.over = false;
} else {
this.over = true;
}
if (!this.select) {
this.gotoAndPlay("rollOver");

_level0.playSound();
mySound.attachSound("rollOver");
mySound.start();
}
}

curBtn.onRollOut = curBtn.onReleaseOutside = function() {
if (this.over) {
this.over = false;
} else {
this.over = true;
}
if (!this.select) {
this.gotoAndPlay("rollOut");
}
}

curBtn.onRelease = function() {
if (!this.select) {
this.select = true;
this.gotoAndStop("released");
_level0.playSound();
mySound.attachSound("hit");
mySound.start();

lastClicked.gotoAndPlay("rollOut");
lastClicked.select = false;
lastClicked = this;

if (!this == 1) { //this part is not working correctly...
trace("sound are off");
} else {
trace("sounds are on");
}

}
}
}
}

Sound Toggle Problems
I am creating a cd in Flash.
Frame 1 is an intro page that directs to frame 2.
Frame 2 starts background music and directs to frame 5. It also houses main buttons for the home page (frame 5), exit and a sound toggle.
Frame 5 is the home page with buttons that direct to several other pages that direct back to frame 5.

Here is the problem. I have the sound toggle set-up to start and stop the sound. Once you have the sound stopped and you select another frame/page from the list on frame 5...everytime you hit the home button the music starts again, even though the home button takes you to frame 5 and the keyframe for the music is frame 2.

I'm new to all of this so I'm a bit frustrated. Is there a code that can be put in frame 5 that states "if the music is on leave it on and if it's off leave it off", or is there a way of coding the toggle that will not allow this to happen?

Thanks

Toggle Button W/o Sound
hello again.

i'm trying to create a projector w/ window functionality,
ie. close, max, min

i got the close no problem but now i'm stuck w/ the minimize-maximize button.

anyone have any good resources on how to make a simple toggle button that would suit my needs.

thanks,

Sound Toggle Button Help
i wondered if anyone knows how to do a sound toggle button to play and stop a sound clip

thanks

Sound Toggle Using StopAllSounds();
I have created a game where all the main actionscript takes place in one frame.

For extra functionality I was going to add a button to toggle on/off sounds, after searching this forums and others Im left confused how to implement this.

If i choose to use stopAllSounds() Im aware it only stops the current sounds and will not interfere with sounds about to occur.

Collision detection and random sounds occur within my game on an interval, is there a simple way to turn off all sounds permenantly?

The only other id would be a button with a toggle and use multiple IF statements to check status of sound on/off.

Thanks
Rob

Toggle On/off A Looping Sound
I know this one's easy on you guys...

How do you loop a sound and control it by a toggle button. I want my sound to automatically load when the movie clip loads.

anyone?

Toggle Sound Actionscript 2.0
Hello,
I have a button, just one button, that I want to be able to use to toggle sound on and off. On the button I have included the following actionscript:

on (release) {
stopAllSounds();
}

Toggle Sound Actionscript 2.0
Hello,
I have a button, just one button, that I want to be able to use to toggle sound on and off. On the button I have included the following actionscript:

on (release) {
stopAllSounds();
}
Can I add additional script to turn it back on again? Maybe an if statement? The sound is currently being loaded and I cannot really add additional frames to make this work. I have to be able to include the script in one step if possible. Unless a movie with several buttons is the only way to go.

Thanks!

Toggle Button W/o Sound
hello again.

i'm trying to create a projector w/ window functionality,
ie. close, max, min

i got the close no problem but now i'm stuck w/ the minimize-maximize button.

anyone have any good resources on how to make a simple toggle button that would suit my needs.

thanks,

Simple Sound Toggle Button
I want to have an on/off button for some background music(Just a short loop that will play over and over). What is the simplest way to do this? I can't seem to quite find a tutorial on this site. (Or maybe I missed it) Thanks in advance for any help!

Problem On My Sound Toggle Button
I am facing a problem for my sound toggle on/off button. I'm working on an introduction piece that has background sound loaded when the movie is launched. I need a sound toggle on/off button to control the background music. Attached here is what I have done..but there are 2 problems here.

1st problem: When I click on the “sound On” button in order to turn off the music, it didn’t turn off the music instead the music is played again, therefore I have 2 background music playing concurrently.

2nd problem: The “Sound On/Off” button – my “sound on” button always displayed whenever I go to other scenes although the music is turned off. The button should display according to what I have toggled regardless of the scenes I go.


i'm a graphic designer and not much of an actionscript coder, and i need a little help getting started here. any help is appreciated.

Probem On Sound Toggle Button
problem on my sound toggle button
I am facing a problem for my sound toggle on/off button. I'm working on an introduction piece that has background sound loaded when the movie is launched. I need a sound toggle on/off button to control the background music. Attached here is what I have done..but there are 2 problems here...need experts to help in solving my code..

1st problem: When I click on the “sound On” button in order to turn off the music, it didn’t turn off the music instead the music is played again, therefore I have 2 background music playing concurrently.

2nd problem: The “Sound On/Off” button – my “sound on” button always displayed whenever I go to other scenes although the music is turned off. The button should display according to what I have toggled regardless of the scenes I go.


i'm a graphic designer and not much of an actionscript coder, and i need a little help getting started here. any help is appreciated.

Streaming Mp3 With Sound Toggle Fader
Hi folks,

What I'm looking to do with the attached file is call up the published swf on my main page using loadMovieNum("sound.swf", 2);

What's happening is that the sound graphic appears, but the sound isn't playing?

Any ideas why this is?

P.S. Forget the mp3 that is on the file - it's the only sound I have thats small enough to ensure the fla is a reasonable size to attach!

Thanks.

Heeeelp - Sound Toggle Problem?
Im new to this as/ stuff and finding myself a bit lost on sound control in MX. I have various buttons with sound files attached to their down state. I want to have an on/off toggle which will switch off all sounds globally regardless of their location - is this possible?

All the tutorials I have found refer to looping bg music etc embedded in the same mc - is there an example out there that will show me how or does anyone have some script expertise they dont mind sharing.

Any thoughts welcome - the simpler the better!

D

Sound Toggle On Template File
I have a Template file I am editing that plays music in the background. I want to shut it off when a Video is loaded so I added a stopAllSounds to the button. Works fine; however, I cannot figure out how to turn it back on again, as the template designer placed the sound file into a button rather than creating a sound Object. Was hoping someone could help me figure out how to restore sounds (I have tried adding Frame Labels to his sound movie/button but it returns me to the opening on the animation.

I have posted the file here if anyone would like to help. If no time for that, is there a simple way to output what is happening when I hit the toggle button, so I can copy that and try it?

Thanks again in advance.

Help With Toggle Button (sound Fade In/out)
Just need some help modifying the script in this tutorial:

http://www.actionscript.org/tutorial...on/index.shtml

I've tried unsuccessfully to speed up the fade in/out of the sound. Does anyone know how I would go about doing it?

Cheers,
iota.

Sound Fader Toggle Button
I followed the tutorial that was recommended on Flashkit.com for the toggle button with sound fade and it worked great. However, I have a little problem. I created a website entirely in Flash, but rather than create a single navigation with a container MC and then load mc for each page, I created one MC with scenes for each page. (I haven’t quite mastered the single nav thing yet…baby steps.) So I have my music clip loading on the intro animation and then the site loads and the music plays continually. I have placed the sound button on each page, so when you click the button, the music fades out. I altered the script so that the volume would be 100 and not 0, but that doesn’t seem to be the problem. When you click on another page, the music is playing up full again. I need the sound clip to only play (or not play) if the button is clicked. Given the way my site is built, is this possible? Perhaps there should be an If- Then code to see if the music is playing or not. Any help is appreciated. Here is the code as I have it on each page.



var s = 1;

// initiate sound

music = new Sound();

music.attachSound("firstsound");

music.start(0, 999999);

// set the volume of the sound to zero

music.setVolume(100);

// set a variable named 'vol'

vol = 100;

// set another variable named 'fade', putting a setInterval function in it

fade = setInterval(fadeIn, 100);

// set the initial fade in function

function fadeIn() {

// fade the sound in with an increment of 3 in the variable 'vol'

vol += 20;

music.setVolume(vol);

// put an if condition to restrict the increment in volume after it reaches to 100

if (vol>=100) {

clearInterval(fade);

// create the 'step' variable

step = 1;

// create the 'fade' variable

Fade = 0;

}

}

// create the fade in and out function

// function executed on onEnterFrame

_root.onEnterFrame = function() {

// set fade out

if (Fade == 1) {

vol = vol-step;

if (vol<0) {

vol = 0;

}

music.setVolume(vol);

// set fade in

} else {

vol = vol+step;

if (vol>100) {

vol = 100;

}

music.setVolume(vol);

}

};



Thanks for any help or ideas.

Mute Sound With A Toggle Switch
Is there a way to make this work with Action Script?

I need one button/toggle switch to mute sound on or off. I DO NOT want to just shut the sound off, I need to have it in the background just in case the user user wants to pick up the audio at the spot it is at in the animation--without restarting it.

any suggestions?

Thanks
Janet

Sound Fader Toggle Button
I followed the tutorial that was recommended on Flashkit.com for the toggle button with sound fade and it worked great. However, I have a little problem. I created a website entirely in Flash, but rather than create a single navigation with a container MC and then load mc for each page, I created one MC with scenes for each page. (I haven’t quite mastered the single nav thing yet…baby steps.) So I have my music clip loading on the intro animation and then the site loads and the music plays continually. I have placed the sound button on each page, so when you click the button, the music fades out. I altered the script so that the volume would be 100 and not 0, but that doesn’t seem to be the problem. When you click on another page, the music is playing up full again. I need the sound clip to only play (or not play) if the button is clicked. Given the way my site is built, is this possible? Perhaps there should be an If- Then code to see if the music is playing or not. Any help is appreciated. Here is the code as I have it on each page.



var s = 1;

// initiate sound

music = new Sound();

music.attachSound("firstsound");

music.start(0, 999999);

// set the volume of the sound to zero

music.setVolume(100);

// set a variable named 'vol'

vol = 100;

// set another variable named 'fade', putting a setInterval function in it

fade = setInterval(fadeIn, 100);

// set the initial fade in function

function fadeIn() {

// fade the sound in with an increment of 3 in the variable 'vol'

vol += 20;

music.setVolume(vol);

// put an if condition to restrict the increment in volume after it reaches to 100

if (vol>=100) {

clearInterval(fade);

// create the 'step' variable

step = 1;

// create the 'fade' variable

Fade = 0;

}

}

// create the fade in and out function

// function executed on onEnterFrame

_root.onEnterFrame = function() {

// set fade out

if (Fade == 1) {

vol = vol-step;

if (vol<0) {

vol = 0;

}

music.setVolume(vol);

// set fade in

} else {

vol = vol+step;

if (vol>100) {

vol = 100;

}

music.setVolume(vol);

}

};



Thanks for any help or ideas.

How Do You Create A Toggle Button For Turning Sound On And Off
Hi,

I'm trying to create buttons for turning music off and on. I'd like it to work like toggle so when you turn off the music, you now have the option to turn it back on. Does anyone have a scripts they could share with me? I would really appreciate any help!

Thank You!

Kim

Sound Toggle For Multiple Scene/sounds?
my site is structured such that clicking on a new section calls on a different sound via a/s (sounds have been linked as objects).

i cant come up with a conceptual framework for making a mute button that would (i) stop the current sound being played, (ii) stop any subsequent sounds being fired because a new section is clicked on, *and* (iii) continue the sound assigned to the current section once it's un-muted.

granted that my a/s skills frankly suck, this has been driving me up the wall and all the tutorials / fla's ive found only deal with one sound.

at worst, i can do a wanna-be sound toggle via stopAllSounds(); but that doesn't take care of (ii) and (iii) above.

if anyone can give me a general conceptual framework (a separate sound mc?), i'd greatly appreciate it. thanks in advance.

yjk

Sound Toggle Button With Drop-Down Menu
Hello Everyone. As seen on the .swf file that I have included in this post, I am having trouble with the audio button at the bottom of the page. I want to make my red audio button at the bottom work correctly. So far, I am able to get the button to come down, but I can't get the button to stay down when I click the music off. Also, the button doesn't seem to remember the last setting once it returns to the carriage. It resets itself. Can you help me please? I can provide the .fla file via e-mail if necessary.

Thank you in advance.

Kelly

[F8] Sound/Volume Toggle Button Issue...
I have an audio track on one layer I want to be able to stop and start, without interfering with an animation that is running on its own layer - I created two MovieClips (mcSndOn and mcSndOff), attached sound to sndPlay,and set the alpha of each movieclip and volume of sndPlay:

var mcSndOn, mcSndOff:Button;
with(mcSndOn) {
_alpha = 10;
}
with(mcSndOff) {
_alpha = 100;
}

var sndPlay:Sound = new Sound();
sndPlay.attachSound("intro.mp3");
sndPlay.setVolume(100);

mcSndOn.onRelease = function():Void {
mcSndOn._alpha = 10;
mcSndOff._alpha = 100;
sndPlay.setVolume(100);

}
mcSndOff.onRelease = function():Void {
mcSndOn._alpha = 100;
mcSndOff._alpha = 10;
sndPlay.setVolume(0);
}

This works perfectly - each button fades out and back in again, and the volume of the audio goes up and down, however, I want to use only one MovieClip to toggle the volume.

I made an onOff MovieClip with two buttons - 1st frame is offBtn, 2nd frame is onBtn, both have:

on(release) {
gotoAndStop();
}

with the respective frame number within the parenthesis on the MovieClip timeline.... i.e. gotoAndStop(2) .

When I brought this onOff MovieClip onto the stage, I named it mcOnOff, and then did this on the first frame of my ACTIONS layer:

var sndPlay:Sound = new Sound();
sndPlay.attachSound("intro.mp3");
sndPlay.setVolume(100);

var mcOnOff:Button;

this.mcOnOff.offBtn.onRelease = function():Void {
sndPlay.setVolume(0);
}

this.mcOnOff.onBtn.onRelease = function():Void {
sndPlay.setVolume(100);
}


The button toggles perfectly - I click the 'off' button and the 'on' button appears, and when I click the 'on' button the 'off' button appears. However, there is no effect on the volume of the audio track!

What am I doing wrong here? How do I get each button within the onOff MovieClip to control the volume of the audio?

FMX Help Needed ActionScipt For Multiple Sound Toggle
Hello All,
I have been trying to make a sound control panel in an SWF movie that toggles through about 4 different music tracks. I have not been able to get the if/else statements to work for the button. Could someone tell me what is wrong with this script(below)? 1-4 are the tracks in my library and I have made the export linkage for all them. Any help would be appreciated!

Frame Script
_root.music=true;
_root.music2=true;
techno=new Sound();
techno.attachSound("1");
techno.start();

techno1=new Sound();
techno1.attachSound("2");

techno2=new Sound();
techno2.attachSound("3");

techno3=new Sound();
techno3.attachSound("4")


Object(button) Script

on(release) {
if(_root.music == true){
techno.stop();
techno1.start();
_root.music=false;
} else {
techno1.stop();
techno2.start();
_root.music=true;
}

if(_root.music == true){
techno.stop();
techno1.start();
_root.music=false;
} else {
techno1.stop();
techno2.start();
_root.music=true;
}
}

FMX Help Needed ActionScipt For Multiple Sound Toggle
Hello All,
I have been trying to make a sound control panel in an SWF movie that toggles through about 4 different music tracks. I have not been able to get the if/else statements to work for the button. Could someone tell me what is wrong with this script(below)? 1-4 are the tracks in my library and I have made the export linkage for all them. Any help would be appreciated!

Frame Script
_root.music=true;
_root.music2=true;
techno=new Sound();
techno.attachSound("1");
techno.start();

techno1=new Sound();
techno1.attachSound("2");

techno2=new Sound();
techno2.attachSound("3");

techno3=new Sound();
techno3.attachSound("4")


Object(button) Script

on(release) {
if(_root.music == true){
techno.stop();
techno1.start();
_root.music=false;
} else {
techno1.stop();
techno2.start();
_root.music=true;
}

if(_root.music == true){
techno.stop();
techno1.start();
_root.music=false;
} else {
techno1.stop();
techno2.start();
_root.music=true;
}
}

Sound Toggle Conflict With Music Fade In/out Scripts
Hi All!
I have a video and background music in one flash file. I need the background music to fade out when the video is playing, and fade back in when the video is paused. Everything works fine until the Music On/Off button is inserted.

If you try out the attached FLA, the background music is able to fade out when the video is played and fade in when the video is paused. But once you toggle the Music On/Off button, the background music fade in/fade out doesn't work anymore.

Download FLA here:
http://download.yousendit.com/DD320A5C076D84D5


Any help is deeply appreciated! Thanks!


cheers,
Christina L.

Urgent Help Needed/toggle Sound Mute With Rollover Button AS3
I am currently working on an animation with a band soundtrack. The animation loads 5 sound objects, 1 being the full soundtrack playing and 4 being the singled out instruments (muted) of the band. All 5 sounds are synchronized. There are 4 buttons representing each of the instruments and I want to mute the main sound and un-mute the instrument the button represents by rolling over and reverse this on rolling out.
This is the script i used to make the sounds play:

import flash.media.SoundChannel;
var sc:SoundChannel=new SoundChannel();
sc=new soundtrack().play();
sc.soundTransform=new SoundTransform(1);
sc=new trumpet().play();
sc.soundTransform=new SoundTransform(0);
sc=new guitar().play();
sc.soundTransform=new SoundTransform(0);
sc=new drums().play();
sc.soundTransform=new SoundTransform(0);
sc=new contrabass().play();
sc.soundTransform=new SoundTransform(0);

Anyone can help with the button scripts please?
Thomas

How Do I Make A "universal" Sound Toggle?
Okay, I'm really new to Flash, and I'm modifiying a game source I found online (don't worry, the site said it was okay for non-profit purposes). I'm doing really well, but now I've come up against a roadblock. I want to add in a keyboard toggle that will turn on and off all the sound in the game, but I don't know how and I can't find a tutorial....

Thanks in advance

Copyright © 2005-08 www.BigResource.com, All rights reserved