ActionScript 3.0 :: Sprite Button Not Toggling Sound Volume?
Jul 21, 2010
This is a completely AS3 scripted, and dynamic project, meaning I cant use any assets from the library.
1 - This button is a mute. � Currently the loaded sound now fades in with a timer.� I want the button to over-ride any sound elements on the stage: the mp3 and later a flv movie as well.� In the below example the button only interferes with fade, and dosen't actually override it, after the fade - it dont do jack. � SoundMixer.stopAll(); will of course kill everything but I cant toggle this(can I?)
2 - The toggle button itself � I've loaded two png's into a sprite, and created a toggle button from them using an if statement. � Is this best practice? or would you recommend something else?� Perhaps SimpleButton?
ActionScript Code:
var btmUpURL:String = "a_icn-1.png";
var btnDwnURL:String = "a_icn-0.png";
var btnLoader1:Loader = new Loader();
var btnLoader0:Loader = new Loader();
This is a completely AS3 scripted, and dynamic project, meaning I cant use any assets from the library.
1 - This button is a mute.
� Currently the loaded sound now fades in with a timer.� I want the button to over-ride any sound elements on the stage: the mp3 and later a flv movie as well.� In the below example the button only interferes with fade, and dosen't actually override it, after the fade - it dont do jack. � SoundMixer.stopAll(); will of course kill everything but I cant toggle this(can I?)
2 - The toggle button itself� I've loaded two png's into a sprite, and created a toggle button from them using an if statement. � Is this best practice? or would you recommend something else?� Perhaps SimpleButton?
Basically I am working on my personal portfolio and am not that good with AS. I have made a volume box that appears once the sound button is pressed. This box includes on and off buttons. The problem is how do I make the box stay, once the user clicks on a different button e.g. home? Its it simply a case of using keyframing or is it AS? and example of what I am trying to create is [URL]. Check the sound options.
I'm building a video player and am kinda stuck at the volume slider part. It's a YouTube style vertical slider, meaning if the slider is in the top position volume should be 100% and if the slider is dragged to the bottom position sound should be 0. Currently it's doing the opposite of what I want :(
Dragging the slider down will make the sound louder, while dragging up lowers it.
Here is my code below dealing with the volume slider.
[Code]....
The (-4) is an offset value so when you drag it all the way to turn it off, it's 0 and not 4. I need to reverse this somehow, so the traces above will swap... going down will make userVolume = 4 and going up will make it 30.
I am new to AS, but not new to programming.I'm using Flash CS4.I have two button symbols, PlayBTN and PauseBTN. They are used to control the playback of a slideshow. When I use either one or the other to control the slideshow, it works. However, what I want to do is toggle between the two buttons, so that they work together like this:
1. If the slideshow is playing, PauseBTN is visible. If PauseBTN is clicked, the slideshow stops, and PlayBTN becomes visible.
2. If the slideshow is paused, PlayBTN is visible. If PlayBTN is clicked, the slideshow stops, and PauseBTN becomes visible.
In other words, clicking the button not only controls the slideshow, but changes which button is visible.I had this working using a two-frame movie clip and static bitmaps, but when I swap out the bitmaps for the buttons, the button rollovers stop working.
I have a button in action script with toggle="true". Now when I click the button its color changes and it looks as if it has been disabled (but its actually not). I need to know which property of this button has changed? For example if I need to know somewhere in my code the "toggled state" (if there is any such thing) of this button, which property of this button should I check?
I have created a Pause and Play button that toggles between states. It controls a Timeline with synced Sound. When I use it the sound and animation go out of sync. Can anyone help me with this or perhaps have better code I could swap out to make this work?
Below is what I am currently using:On the first frame of an Action Script layer put this AS:
Put the Pause and Play buttons directly over each other on 2 layers for the duration of the timeline.Pause Button on top. (unless you have a STOP on the first line then maybe the Play button will start it.
How do you deal with toggling multiple buttons? When one button clicks on the previous active button(s) turns off.
What is the standard practice for dealing with this? Have listeners on all the buttons checking if their name is in an activeButton variable (which seems process intensive with all those listeners going)
A FOR loop to go through all the buttons states and check the activeButton variable when any button is clicked?
That is two ways I have done it but I think there has to be other ways that might be more elegant.
I have an application with a collection of sounds in the timeline. One sound file is recorded at a slightly lower volume than the others. I know I could change this in Audacity but I'm wondering whether I could attach a line of actionscript to its button to raise its volume slightly.I know its possible to do this when playing sounds with actionscript directly from the library, but that would be too big a departure from the development style used.
If I have library song playing using a simple code like: var mySong:Song = new Song();mySong.play(); How do I use a button to control its volume so that each time it is clicked the volume goes up or down by a little.
Is it possibleto get the sound volume of of a specific frame or specific time of sound item with the Flash Javascript API maybe together with Action Script?
I'm trying to set a volume to my external sound. I'm using the following code, there're no errors, but the volume is not affected...
var req:URLRequest = new URLRequest("squeeak3.mp3");var sound:Sound = new Sound();var controller:SoundChannel = new SoundChannel();var myTransform = new SoundTransform();myTransform.volume = 0.2;controller.soundTransform = myTransform;
I can't seem to figure out how I set the volume of a single sound object. Everytime I use setVolume on a sound, it is applied to *all* sound objects playing The code that I'm using :
Code: music = new Sound(); music.attachSound("music");
can anyone tell me how to loop 5 different sounds, drums, bass, sax etc. When i use :
[Code]...
and play them all, it's ok, looping fine, but what i want to do is to have 5 buttons that control those 5 sounds. turning of and on some of them... i tried with "secondSound.setVolume(0)" to turn off 2nd sound, but that kill them all... CAN i SOMEHOW set volume down just for one sound? OR if thats not possible, i need bass or sax sound to start again, when button is clicked, in the same position where drums sound is... but when loop start again to start also from "0" i've also tried reading firstsound position:
Every piece of info I can find about how to set the volume of a sound in Flash with setVolume, mentions that you need to reference the movie clip where the sound is stored....to target just that sound, and not the whole timeline.Is there a relatively easy way to set the volume of different sounds that are loaded into the same movie clip? I'm loading my sounds with AS on the first frame of my movie, and would prefer not to have to create separate movie clips for each sound..
I'm having issues with controlling multiple sound volumes in flash. What I need to have happen is a Background music softly playing while a voice over is also playing.
This is what i have in the first frame of my main timeline
Code: firstSound = new Sound(BGMusic_mc); firstSound.attachSound("LatinRockMusic"); firstSound.setVolume(10);
[Code]...
but when it starts to play the voice sound the volume jumps up to 100. I need the first sound to stay at 10 and the voice sound to be at 100.
I have several sounds of same length playing on the Timeline, each playing in loop on their own layer so that they can be syncronised on the same tempo (i did not managed to do this through pure AS3).
Is it possible to manipulate the sounds on this timeline individually via actionscript (ie: add listeners, change volume, read position) ?
I have a timeline with a sound in it set to sync because I am scrubbing the main timeline.... I now want to control the volume of the sound in the timeline..is that possible in AS3??
sometime like : var my_globalSound:Sound = new Sound(stage); that of course doesn't work, but how would I get access to the sound set in the timeline...
I have a sound running on a timeline and I want to have an AS2 script that will reduce the volume by, say 50%, and have the reduction in volume happen over a number of seconds so it is not an abrupt change.
What Im looking to do is decrement the volume level on each iteration of a looped sound.[code]How do I check each time it loops? I'm currently storing all playing sounds by ID inside a Dictionary object. Keep in mind that there will be different sound playing. I wasn't sure if I should be using a SoundChannel here either.
Searching for how to change the volume of sounds, I always get this irritating snd=new Sound(URLRequest), followed by snd.setVolume(val). Oh, fine, but my sound is not an URLRequest, it's an embed.
I've made a lot of random attempts (1) to no avail. How am I supposed to do that instead?
(1) including casting my class to Sound, creating a Sound with the embed class as argument, creating a SoundTransform and setting it to the channel, etc.
Im having trouble try to decrement the volume level of a sound after each loop. I am playing the sound just like this (not in a SoundChannel):
ActionScript Code: var playCh:Dictionary = new Dictionary(); //.... private static function loopMySnd(id:String, loopAmount:int):void{
[code]....
The problem is that the COMPLETE only picks up the first time the sound cmpletes playing and not the second or third. How do I check each time it loops? I am currently storing all playing sounds by ID inside a Dictionary object.
Cannot read property (or target) a Sound thats playing in a SoundChannel.... in this case I am refering to a class the extends the Sound class (SoundEffect class), that is currently playing in a SoundChannel. Each SoundEffect has a volumeLevel property that I would like to restore once I have unmuted the SoundEffect's in my application. I cannot figure out how to target that property once its playing in the Channel.I am extending the Sound class:
ActionScript Code: public class SoundEffect extends Sound { public var ID:String;
I am trying to make a volume control in my flash movie with actionscript 2.0 Here is my code:
[Code]....
but the problem is the first time I lanch my movie it comes in a good volume.As soon as I hit the up or down button to lower or increase the volume firts the volume goes down a lot and then starts to increase or decrease its volume.