ActionScript 2.0 :: Toggle Sound On And Off?
Apr 28, 2008
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.
View 1 Replies
Similar Posts:
Jan 10, 2011
I'm new to flash and just need to do a simple task but I can't manage to get it to work. I'm trying to import a video (flv) into a SWF container and need to AS functions which should be exposed to JS (using liveconnect or anything else). These two function should toggle sound on/off and toggle play/pause. I dont need any user interface or a full featured player, just these two functions.
View 1 Replies
Feb 20, 2009
I can get my mc button to mute it once, but never turn on again.The audio is a voice over in streaming in the main timeline.
Code:
var soundOn:Boolean = true;
onoff_btn.addEventListener(MouseEvent.CLICK,toggleSound);
onoff_btn.buttonMode = true;
[code]....
View 6 Replies
Apr 3, 2007
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.
View 1 Replies
May 31, 2011
The user should be able to toggle on or off the sounds button where clicking (on) will turn on the sounds while the button's label will be changed to 'off'Initially the sound is off.
View 4 Replies
Jan 27, 2009
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?
View 1 Replies
Nov 29, 2010
I have a movie clip on the main stage which loops an animation of a gramophone. On a separate mc in the layer above I have a working toggle button which plays and pauses a loaded mp3, but does not yet pause the MC animation beneath it. I need to find a way to target/pause/resume the gramophone MC insync with the sound button which is in another movieclip
View 0 Replies
Aug 19, 2010
I need it so the music plays at start and then the button will pause/stop it, and then turn into a play graphic which, when pressed, will play it again. I tried editing the code, but I am horrible at programming and of course nothing I tried worked. Please let me know what I have to change to start with music playing, and then have it stop/pause on first press, and alternate "play" and "stop" on subsequent presses.
[Code]...
View 9 Replies
Jan 3, 2010
So I got a toggle button that plays sound when clicked, now I need it to stop playing sound when clicked again.
[Code]...
View 1 Replies
Aug 19, 2010
this is the one code that I could make work, but I need it so the music plays at start and then the button will pause/stop it, and then turn into a play graphic which, when pressed, will play it again. I tried editing the code, but I am horrible at programming and of course nothing I tried worked. Please let me know what I have to change to start with music playing, and then have it stop/pause on first press, and alternate "play" and "stop" on subsequent presses.
[My fla has 2 layers, one for this AS, and one for the buttons... within the symbol section, I have two layers, one for the button common BG, and two frames in the button layer, one for play (triangle) and one for stop (square). They are saved as a movie clip.]
[Code]...
View 5 Replies
Sep 11, 2010
I've googled and googled but got no where or outdated tutorials. Anyone know how to make it so I can toggle audio with buttons using ActionScript 3 on Flash?
View 2 Replies
Jun 3, 2011
Creating the necessary code to make a mute/unmute button in ActionScript 2? I would like the "toggle" button to control a specific sound clip only -- not any other sound within my presentation. Basically I have an intro animation of about 20 seconds that has background music to it. I would like to add a mute toggle button that controls only this music clip and not any other sound found within my presentation. Is this possible? I've seen code for "globally" muting or stopping sounds. I need code for just a specific music clip (sound object?).
View 6 Replies
Sep 3, 2007
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.
View 2 Replies
Apr 28, 2008
I embeded an mp3 into a movie clip, and the source mp3 is professional quality, yet the embedded clip sounds horrible.
Is there a way to toggle any settings when importing a sound clip into the library?
View 2 Replies
Apr 16, 2011
I am triggering short sounds dynamically from the library for a game (Specifically Air for Android). When the user clicks a button the sound can take up to 600ms to actually play. I have set it for any silence before the actual sound by calling the sound like so:
[Code]...
All return the same results. I know there are threads here that talk about this but none have offered a real solution that I can find. Is there no way to cache the sound or store it in a buffer?
View 1 Replies
Mar 15, 2010
note;ok considerinh flash swfs in flashplayer app all works fine so i think the problem is not inside swf but HTML when i run my index.html for the 1st time in browser(all of them i tried) it opens in normal mode. i hit toggle button and it switches me into a fullscreen mode. great success...well it aint)
sheme:
normal ----(1click) -- fullscrenn---(1click)--Normal
now when i go back from fullscr in to normal mode for the 2nd time, and want to hit toggle button to get again for the 2nd time to fullscren, i click the button and all that happends is my hand pointer turns to arrow pointer. And then i have to rollover and click button again to get to full scren mode..
sheme:
normal ----(1click) -- fullscrenn---(1click)--Normal ---(2clicks)--Fullscreen---(1click)--Normal
NOTE;from fullscreen to normal it always works ok(browser or flash palyer)but from 2nd normal to 2nd fullscreen i gotta click twice...something like once to activate a button again and then to click it for the action to execute..i dont know if i run this only in flash player localy toggle works perfect, and that is why i think the problem is in html parameters and not in swf...
View 4 Replies
Mar 22, 2010
I have a diagram with three buttons that when clicked, draws a line from that button to the corresponding movieclip on the stage. All this works fine but I'd like to build in a toggle button so I can turn each line off in any order. I'm having trouble understanding how to reference each shape that's been draw on the stage so I can remove it
Code:
var btnArray:Array = new Array(btn1, btn2, btn3);
var spotArray:Array = new Array(hotspot1, hotspot2, hotspot3);
[code].....
View 2 Replies
Oct 8, 2009
I am trying to create an interface with multiple buttons (left side of screen) that will toggle on or off (increase alpha) multiple graphic fields (right side of screen) that are not mutually exclusive
Ex.
If btn1 is pressed (checked), fields a, b, c will turn on.
If btn1 is pressed (unchecked) again, fields a, b, c will turn off.
If btn2 is pressed (checked), fields b, c, d will turn on.
If btn2 is pressed again (unchecked), fields b, c, d will turn off.
[code]....
View 2 Replies
Jun 18, 2009
I can't figure out how to get a button to toggle between to functions?It has to be more simple than an if()...else().. statement right?example:
myBtn_mc.addEventListener(MouseEvent.MOUSE_UP, what goes here?);
/* if the MOUSE_UP event is called and the chalkboard is blank, then write to the chalkboard
else erase the chalkboard */[code].......
View 3 Replies
Dec 5, 2006
I'm simply creating a button in flash that should alternate between a 'play' graphic (i.e. > ) and a pause graphic (i.e. || ) every time its clicked. That's all!
In shockwave I would simply type a line of code that would set a new memberNumber or memberName to swap the graphics on mouseUp. How do I do it in Flash? I called a friend and he though I had to do something like create a movieClip inside a button or vice versa. It all seems rather complicated for such a simple task.
View 9 Replies
Mar 5, 2011
What would be the best way to make a toggle button -- like one where you switch it on, and it stays on until you switch it off. I have two jpegs one for on and one for off.
View 4 Replies
May 24, 2004
i have been stuck with this for days so thought i'd try this forum. on the main timeline i'm trying to have an on/off music toggle button. here's the code on the first frame:
[Code]...
whenever i click the toggle button it restarts the sound and downloads it again. can anyone tell me where my code is wrong or what i have to add?
View 1 Replies
Nov 9, 2006
I need to add text on screen (for hearing impaired) to a simple movie I created. I just need to have text toggle on and off. I don't know how to actionscript the mc or button. Working in F8, publishing to F6.I did see the visibility on/off rollover thread... but I'm not actionscript saavy and can't make the leap to an onpress or onrelease button, rather than a rollover.
View 7 Replies
Feb 1, 2007
I'm pretty sure this is doable, but I'm not entirely sure how to set it up. Basically, I would like a specific movieclip to play when I am online and another to play when I am offline (kind of like a "hello, I'm viewing this site and am online" type thing, so others know I am at my computer).
View 1 Replies
Jun 21, 2007
I am currently building a music player. I haven't been working with flash very long (a few months only) and i'm unsure how to switch between a play and pause button on the stage (i reckon it's a newbie qThis is the function i'm using to pause and play the track (which works fine... i just duno how to toggle the buttons when you click on them).
function toggle_pause() {
_global.currently_playing;
_global.write_debug;
[code].....
View 3 Replies
May 15, 2002
I'd like to create a toggle button for example I've a button inside a mc...now if I click it'll zoom(that's ok) and the very next time I click it it'll go back to it's earlier position i.e. the button should work as a toggle button
View 3 Replies
Jan 13, 2011
how to toggle on and off states on my buttons. Once a user clicked one it fades and disables ok as I want but i also want it to enable and fade back up again when they select another button. Below is my code:
PHP Code:
function GenerateShapes(shape_xml) {
_global.shape_images = shape_xml.firstChild.childNodes;
_global.disableShapeButtons = new Array();
[Code].....
View 1 Replies
Mar 8, 2009
I am trying to use the letter x to stop and play my movie, I got it to sucessfully stop but I am having trouble restarting it once it is stopped, [code]
View 3 Replies
Oct 29, 2009
im trying to get my script to work PHP Code:
[Code]...
View 3 Replies
Jul 27, 2010
I am dynamically creating a bunch of buttons which each toggle their variable on and off, causing corresponding graphics to hide.I also want to have a toggle All on and off button that affects all the variables.I can't seem to get my head around the best approach to turning all the individual variables on/off when I don't really know what those variables will be yet, cause it will depend on how each version of this gets set up.
View 2 Replies