ActionScript 1/2 :: Adjusting Volume With SoundChannel?

Sep 3, 2007

AS2 -> AS3 migration: doncha just love it?!have a look at the attached code. selection one makes us anew sound and gets it playting, great. then we need to adjust thevolume so we read in the files that:You can alter the volume and panning while a sound is playingby setting the pan or volume properties of a SoundTransform objectand then applying that object as the soundTransform property of aSoundChannel object.great, so selection 2 in code below should do that, right?

View 7 Replies


Similar Posts:


Actionscript 3.0 :: Changing Volume With SoundChannel

Jun 1, 2009

Code: Select allprivate var musicFadeAmount:Number = 0.005; // Amount to fade the music
// Helper function to change volume
private function SetVolume(vol:Number, sc:SoundChannel):void


[Code].....

I run the last two rows in an ENTER_FRAME loop, and from the trace in the SetVolume() function I can see that scMusicIdle changes it's volume like it's supposed to, but scMusic keeps it's volume. I can change the volume when I play the sound with a new SoundTransform().

how to fade between two tracks in a better way I'm all ears. If it makes any difference it's an AIR 1.5 app.

View 1 Replies

ActionScript 2.0 :: Adjusting Volume In External FLV?

Apr 30, 2010

I'm looking for a way to adjust the volume in an external flv. The code below sets the volume, is there any way to have it start at one volume and fade to "0" over the length of the flv?

this.createEmptyMovieClip('snd', 0);
this.snd.attachAudio(this.ns); //attach NetStream
this.audio = new Sound(this.snd); //Set MC as source
this.audio.setVolume(80);

I also tried start/stop buttons, but they start and stop the flv also, any way to set them up so the flv keeps playing without the sound?

View 1 Replies

ActionScript 3.0 :: Adjusting Volume Of Video Component Inside Movieclip?

Apr 16, 2010

How would I adjust the volume of a video component nested inside a movieclip? I've tried the following methods:

Code:
mcName.vidName.setVolume(0);
Result: ReferenceError: Error #1069: Property setVolume not found on flash.media.Video and

[code].....

View 4 Replies

ActionScript 3.0 :: Save The SoundChannel.position Number (and Also Call SoundChannel.stop()) In Correct Time

Dec 6, 2008

I just finished a simple music player... For testing purposes. I upload it in the following address:http:[url]....with 10 music songs that I had recorded from radio stations(added the last 2 twice for testing).The problem is that when a song has totally loaded, stop action taken needs about 1 second to be applied!I.e. When I press "STOP", the sound continue to play for 1 sec before stop. When I push "pause" it takes one second for the music to stop!

However when using resume (second time pause) the sound starts instantly! Thus I guess there is an issue with stop()function of the SoundChannel object that I am using to stop the sound. Also notice that when unpause the music, it continue ~one second before the last sound - which means that I saved the soundChannel.position number (and also call soundChannel.stop()) in correct time, but it didn't stop immediately - bug!?

This only happens when the application runs through a browser(plugin v. 10) - programmed in CS3.

PS1. Notice that ,this also happens when I change Volume too. Thus because Stop and Volume are parts of SoundChannel, I guess there might be a bug with SoundChannel in online plugins..... :/

PS2. Notice that ,this also happens when I close the browser (firefox). Even if browser is closed the music continue for 1 sec the same way as when pressing stop!.. Thus I guess it's flash bug!...

View 2 Replies

ActionScript 3.0 :: Simple Volume Slider That Controls The Master Volume Of The Entire Swf?

Oct 6, 2009

does anyone have an example of a simple volume slider that controls the master volume of the entire swf?

View 1 Replies

Flash :: Volume Slider - Volume Doesn't Change Until Mouse Over?

Nov 21, 2009

I've created a small music player with a sliding volume control. I'm having trouble with the volume. Though it does control volume properly, if I set the initial volume to less than 100%, the volume always starts at 100% until I move my mouse over the player. At that point, the volume changes to whatever the initial volume is set to.Is this a flash bug, or am I missing something? Here is the affected code (code for other buttons/functions omitted for brevity):

var song_initvolume:Number = 100;
slider_1._x = groove_1._x + song_initvolume;
playSong(0,song_play);[code]....

I'd like to be able to set the volume at say 50%, but the above mentioned behavior happens each time.

View 2 Replies

Flash :: Reverse Sound Volume Math For Volume Slider?

Feb 1, 2010

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.

View 4 Replies

Actionscript 3 :: Volume Controls - Volume On Or Off Through The Games?

Apr 12, 2012

I've got a serious of games which in turn load off a main main swf.I have mute and unmute buttons on the main menu and the same buttons in each game.When I unload/load a game I want the volume to stay as it is so they player doesn't have to keep turning the volume off. AudioOff is the button shown when the volume is off and AudioOn is the button shown when the volume is on.The code I've got now keeps the volume on or off through the games but the buttons aren't showing up correct with this code..

if (SoundVolume.volume == 1)
{
AudioOn.visible = false;[code].....

View 2 Replies

ActionScript 2.0 :: Volume Slides But No Volume Change?

Sep 10, 2011

I converted the slider bar and slider button to buttons. Then, I made the slider button into a movie clip.

Here is the code I placed while slider button was a button:

Code:
on (press) {
startDrag(this, false, left, top, right, bottom);
}

[Code]....

It seems right to me but I don't know. The movie button slides down the slider bar but it just doesn't affect the volume. Going to try to attach my FLA to offer better insight. Just tried to upload it and no matter if it's FLA or zipped FLA, it says it failed.

View 1 Replies

ActionScript 3.0 :: Sound Name From SoundChannel

Apr 17, 2009

I wondered if there is a way to find out from the soundChannel the url of the sound it is currently playing. once I found out its url, i can than use its name to call something else.Or anyway to find out the sound that is playing on a soundChannel.I will know which channel to look into, but different sound will be loaded into this soundChannel.If this is not possible, i thinking along the line of overloading SoundChannel play method so that is fires an event when the sondchannel plays and also find out the name of the sound file it is currently playing.

View 2 Replies

Add Some Sort Of EventListener To SoundChannel?

Jun 30, 2009

I am trying to build a simple player inside my swf file. The code is a bit messy but it seems to work.I´m using a soundChannel for Playback..I´m trying to figure out how to have the player play the next song once the previous one has reached its end.Do I add some sort of EventListener to the soundChannel?[code]...

View 7 Replies

ActionScript 3.0 :: SoundChannel And SoundMixer?

Sep 2, 2010

when do we use SoundChannel and SoundMixer?

View 3 Replies

IDE :: SoundChannel.SOUND_COMPLETE Won't Fire

Jan 12, 2009

i have a little flash-player with a playlist and so, it plays normally a vlc-mp3-stream but has an extended prelisten-function (wich plays the mp3's directly via http, secured with a password)i've got an array with 2 Sound()-objects (for preloading purposes), the code looks like this :

Code:
playStream = url=="";
if (playStream) {
SoundObjects[SN].load(new URLRequest("http://" + URL + ":8001/MIRstream.mp3?" + Math.random()), sloader);
} else {

[code]....

this works for the vlc stream (which is not continuos), but not for the mp3s on the http-server in my opinion, this doesn't makes sense..except, maybe the recent CSRF-hardcore-paranoia [URL]

PS: i use AS3 with flex_sdk_3.2.0.3794 and flashdevelop (i activated flash10-support, but it still works in fp9)

View 1 Replies

ActionScript 3.0 :: SoundChannel In Class Only Plays Once

Dec 27, 2010

The soundChannel only plays once.Im guessing this has to do with using a class?[code]...

View 5 Replies

ActionScript 3.0 :: SoundChannel + AddEventListener Gets 1009?

Jul 9, 2009

I'm having some problems with a script.I developed the app on a mac. It's intended to be both on mac and windows and also air and swf (I save data or not depending if it's installed or not).I've tested it on mac and several pc (winXP) but on win 2003 server and win 2008 server I get an error. Also on a winXP without flash player installed (through the projector) breaks at the same point.The problem is on the red line. It does always work right, sound loads, plays and when it finishes the event is called (in this case it loops). In other cases when sound completes the event should load a screen or so but, as I get an 'Error #1009: Cannot access a property or method of a null object reference' so the movie stops.I need all sounds to be inside flash so I put them in library and set their classes as com.escacs.sound.* (there are many sounds) I can't understand how mainSC can be null or undefined if the previous instruction initializes it.
 
[code]...

View 8 Replies

ActionScript 3.0 :: SoundChannel Null When No Speakers?

Sep 29, 2011

I was debugging sound in an app and decided to make a little test case as I kept getting odd errors... well I just moved to a new desk yesterday so hadn't hooked up speakers yet. Here's the test:
 
var backSound:Sound = new bgSound();
var backChannel:SoundChannel = backSound.play(0, 999);
trace(backChannel);
 
bgSound is just a library sound... if my speakers are unplugged from the sound card backChannel returns null. If speakers a plugged in backChannel is a soundChannel object.

View 1 Replies

Modify Application To Use The Soundchannel Object?

Oct 23, 2009

so I have a lot of classes in actionscript 2. But I need to modify my application to use the soundchannel object for audio monitoring. as far as i know this is only in actionscript 3. so it it possible to write one class in AS3 and leave the rest in AS2?

if not is there a conversion tool which can make the process easier?

View 2 Replies

Actionscript 3 :: SoundChannel.position Inaccurate?

Jun 8, 2011

EDIT: Sorry for the question being reworded, but I am just simplifying the issue. I am not getting accurate values for SoundChannel. position for an external MP3 that is playing.I've tried a variety of audio bitrates and consistently,i am getting a SoundChannel.position that is less (~250 ms) then where the actual audio has played to. As well, the position never equals the duration. It always finishes behind, even when the SOUND_COMPLETE event is generated.

Adobe says any Sound position/duration issues are fixed with the latest Flash Player. I am obviously not getting the same results. I need very accurate position values in order to have a custom draggable timeline and cue points.

View 1 Replies

ActionScript 3.0 :: Attach SoundChannel(s) To NetStream

Jan 15, 2012

I have a Flex(4.6.0) application which creates 3 SoundChannels. I'd like to attach 2 of these channels to a NetStream for publishing, leaving the 3rd SoundChannel only for listening to locally.

The only audio component I can seem to attach to a NetStream is a Microphone, so I could use a Microphone loopback adapter and send ALL sound to the stream, but this would include all channels, windows sounds, sounds from other applications etc.

How do I attach individual soundchannels to a stream, or should I be going about this in a different way?

View 1 Replies

ActionScript 3.0 :: Find 'name' Of A SoundChannel Variable

Jan 30, 2012

I'm creating a mute/unmute button.I have it working correctly, except 1 part.I want to make my SoundChannels remove themselves when the SOUND_COMPLETE Event is fired.I'm storing my Sounds and SoundChannels in an array called "soundsPlayingArray".I want to do 1 of 2 things.Either:

1) Have my "unMuteAll" function check to see whether a song is "playing" before unmuting it.

2) Remove the Sound + SoundChannel from array (and make them null) when the SOUND_COMPLETE Event fires.

How can I figure out what the instance name of the SoundChannel that dispatched the SOUND_COMPLETE event is?[code]

View 1 Replies

ActionScript 3.0 :: Converting Into Strings Into SoundChannel Instance?

Oct 30, 2009

I am trying to call a method that pulls several variables depending upon the button clicked.Depending upon the button, it will play a certain sound/song. Below is what i have so far, if anyone could figure out why i get the following error: TypeError: Error #1034: Type Coercion failed: cannot convert "test_Btn12_soundChnl" to flash.media.SoundChannel."test_Btn12" is the button that i happened to click on at that time.

Code:
public function buttonClick(e:MouseEvent):void {
playSound(MovieClip(e.currentTarget), SoundChannel(String(e.currentTarget.name) +

[code].....

View 3 Replies

ActionScript 3.0 :: SoundChannel Event.sound_complete Not Working?

Mar 4, 2010

For some reasons, my soundchannel event.sound_complete is not working. Basically, my class is to import sound into it and to allow use to change their volumes and the speedness of the sound.
 
This is the tutorial for the speed [URL]
 
Right now, what I want to do is to auto loop back the song once the song have finished play but I have having troubled doing it.

[Code]....

View 5 Replies

ActionScript 3.0 :: Sound Object Or SoundChannel For Various Sounds?

Apr 10, 2010

As I have commented before I am building English teaching apps. I will have music playing in the background, words being pronounced and at times a surprise sentence. All three could sound at the same time at any given point. To build this properly should I use SoundChannel for all of these? 
 
At the moment my code for the music loop is as so. The sound is in the library and exported for AS. Is this code fine or is it better to assign it to the SoundChannel class.

View 1 Replies

ActionScript 3.0 :: Play An Instance Of A Sound In A Soundchannel

May 3, 2011

I have some sounds in my library that I want to play in a soundchannel, but how? This is what I have so far:

var music:Sound = new Sound();var channel:SoundChannel = new SoundChannel();var sTransform:SoundTransform = new SoundTransform();var sound:SoundFile1 = new SoundFile1();  // Note: SoundFile1 is a class; in it is my soundfile in the library// music.load(sound); ??channel = music.play();

View 1 Replies

ActionScript 3.0 :: Soundchannel To Be Empty And To Listen For The Sequencer?

Feb 23, 2012

its for a music sequencer im working on. the class needs an mp3 loaded into the soundchannel to work.I want the soundchannel to be empty and to listen for the sequencer,The visualisation reacts to the sequencer but only when an mp3 is loaded, I just want it to react without an mp3 loaded...

View 3 Replies

AS3 :: Flash - SoundChannel, RemoveEventHandler - Use The Sound Channel?

Apr 5, 2010

Is there a better way to use the sound channel is AS3?

var mySound:Sound = new Sound();
playButton.addEventListener (MouseEvent.CLICK, myPlayButtonHandler);
var myChannel:SoundChannel = new SoundChannel();
function myPlayButtonHandler (e:MouseEvent):void {

[code]....

View 2 Replies

ActionScript 3.0 :: Sound.play() Always Creates A New SoundChannel?

Nov 23, 2009

I've just started working with sound and as I understand it I primarily need two objects: Sound and SoundChannel. Every call to a Sound.play() method will create a new SoundChannel object. So technically, I could write my code like this:

Code:
package
{
import flash.media.Sound;

[code]....

Will simply create a new SoundChannel object and the first one created by the constructor will be garbage collected? As a side note, it's possible to see Adobe's source files e.g.SoundChannel.as. I'm curious as to how the SoundChannel.stop() method works since it doesn't throw an error or exception even if the audio has already stopped playing.

View 3 Replies

ActionScript 3.0 :: SoundChannel Doesn't Stop Properly

Oct 22, 2010

I made a few functions that should fade between tracks very simply. I start with track1, then call my initial function to fade to track2 -- works just fine. Then later when I want to call it to fade back to track1 it will fade track1 in but keep track2 playing (when the first time it properly fades the already playing track out) --Here is the code (all variables are defined earlier):

ActionScript Code:
/* trans is my SoundTransform
channel is my SoundChannel
newSong is a holding var*/

[code]....

View 1 Replies

ActionScript 3.0 :: SoundChannel Stop() Function Not Working?

Dec 3, 2010

I am trying to stop a sound from playing after the user clicks the next button, and I have followed what I was told from others on how to use the SoundChannel but can't seem to get the stop() function to work?

here is the code:

ActionScript Code:
nxt1_btn.addEventListener(MouseEvent.CLICK, next1);
var grad:Sound = new graduationMusic();
var gradChannel:SoundChannel = grad.play(0,int.MAX_VALUE);

[Code].....

Error that keeps popping is : 1120 Access of unidentified property gradChannel.

View 6 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved