Controlling the sound volume of my swf

I am trying to reduce the sound volume of my swf in general. I implemented the code below, but I get this error message: Line 30 1151: A conflict exists with definition in namespace internal.
Thanks for your help
Charine
++++++++++++++++++++++++++++
Here is my code:
package
   import flash.display.MovieClip;
    import flash.utils.Timer;
    import flash.events.TimerEvent;
    import flash.events.MouseEvent;
    import flash.media.Sound;
   import flash.events.Event;
    import flash.media.SoundChannel;
    import flash.media.SoundMixer;
    import flash.media.SoundTransform;
    public class BugGoopFSGame extends MovieClip
       public var mybackground:BackGround;
//        public var LetterArray:LetterArray = new LetterArray(stage);
        public var lettera:A;
        public var cinders:Cinders;
        public var gameTimer:Timer;
        public var spidy:Spidy;
        public var myplaybtn:Play;
        public var timerback:TimerBack;
        public var timermiddle:TimerMiddle;
        public var timerfront:TimerFront;
        public var settings_btn:Settings_btn;
        public var sound1:Sound1;
        public var channel:SoundChannel = (new Sound1()).play(0, int.MAX_VALUE);
        public var channel:SoundTransform = (new Sound1()).volume(0.5,1.0); //This is where the problem is - Line 30 1151: A conflict exists with definition in namespace internal.
        public function BugGoopFSGame()
            sound1 =  new Sound1();
        //rest is not relevant to this

Try this version that I put together. I attached the sound playing to the onClick function at the bottom. This may not be the correct place, you can move the code to any function that you like. The sound will not play from the variable declaration section of the class, it really needs to be in a function.
package  {
            import flash.display.*;
    import flash.utils.Timer;
    import flash.events.*;
    import flash.events.MouseEvent;
    import flash.media.Sound;
    import flash.events.Event;
    import flash.media.SoundChannel;
    import flash.media.SoundMixer;
    import flash.media.SoundTransform;
    import flash.text.*;
    import flash.net.URLRequest;
    public class BugGoopFSGame extends MovieClip
        public var mybackground:BackGround;
        public var letterArray:LetterArray = new LetterArray(stage);
        public var lettera:A;
        public var cinders:Cinders;
        public var gameTimer:Timer;
        public var spidy:Spidy;
        public var myplaybtn:Play;
        public var timerback:TimerBack;
        public var timermiddle:TimerMiddle;
        public var timerfront:TimerFront;
        public var settings_btn:Settings_btn;
        public var sound1:Sound;
        public var channel1:SoundChannel = new SoundChannel();
        public var channel2:SoundTransform = channel1.soundTransform;
        public function BugGoopFSGame()
                              // this assumes that you have a sound file in a movie Library
                              // with a class name of "Sound1"
            sound1 =  new DeltaFog();
            lettera = new A ();
            addChild(lettera);
                              mybackground = new BackGround ();
            addChild(mybackground);
            cinders = new Cinders();
            addChild(cinders);
            spidy = new Spidy();
            addChild(spidy);
            myplaybtn = new Play();
            addChild(myplaybtn);
            timerback = new TimerBack();
            addChild(timerback);
            timermiddle = new TimerMiddle();
            addChild(timermiddle);
            timerfront = new TimerFront();
            addChild(timerfront);
            settings_btn = new Settings_btn();
            addChild(settings_btn);
            gameTimer = new Timer(31,5120);
            //Add event listener for start button
            myplaybtn.addEventListener(MouseEvent.CLICK, startTimer);
            //Add event listener for timer;
            gameTimer.addEventListener(TimerEvent.TIMER, tickTock);
            gameTimer.addEventListener(TimerEvent.TIMER_COMPLETE, timerFinished);
            gameTimer.addEventListener(TimerEvent.TIMER, fadeIn);
            gameTimer.addEventListener(TimerEvent.TIMER, moveA);
            gameTimer.addEventListener(TimerEvent.TIMER, scaleLifeBar);
            //Add event listener for when lettera is clicked
            lettera.addEventListener(MouseEvent.MOUSE_DOWN, onClick);
        //Start timer function
        public function startTimer(timerEvent:MouseEvent):void
            gameTimer.start();
            trace("Timer started");
            myplaybtn.visible = false;
        public function tickTock(timerEvent:TimerEvent):void
            trace("Tick");
        public function timerFinished(timerEvent:TimerEvent):void
            trace("Timer is finished");
        public function scaleLifeBar(timerEvent:TimerEvent):void
            timermiddle.scaleLifeBar();
        public function fadeIn(timerEvent:TimerEvent):void
            lettera.fadeIn();
        public function moveA(timerEvent:TimerEvent):void
            lettera.moveA();
        public function onClick(event:MouseEvent):void
            trace("The letter a was clicked");
                              // this line tells the sound to play, it can also
                              // be "sound1.play(0,int.MAX_VALUE);" if you don't need
                              // the volume
                              channel1 = sound1.play(0, int.MAX_VALUE);
                              // set a value for the volume to be used
                           channel2.volume = .5;
                              // connect the volume to the sound channel
                  channel1.soundTransform = channel2;

Similar Messages

  • Controlling the sound of the external loaded SWF

    I  have a Loader that loads external SWF. The external SWF has sound.
    I'd like to stop, pause and play the sound.
    How?
    Please help me !
    var loader:Loader = new Loader();
    loader.load(new URLRequest("moora.swf"));
    addChild(loader);
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, on_loader_complete);
    var mc:MovieClip;
    var st1:SoundTransform = new SoundTransform();
    var sn:Sound = new Sound();
    var ch:SoundChannel;
    var offset:Number = 0;
    function on_loader_complete(e:Event):void
         mc = MovieClip(loader.content);
         play_btn.addEventListener(MouseEvent.CLICK, on_play_btn);
         pause_btn.addEventListener(MouseEvent.CLICK, on_pause_btn);
         stop_btn.addEventListener(MouseEvent.CLICK, on_stop_btn);
         trace(mc.totalFrames);
    function on_play_btn(e:MouseEvent):void
         mc.play();
         st1.volume = 1;
         mc.soundTransform = st1;
    function on_pause_btn(e:MouseEvent):void
         mc.stop();
         st1.volume = 0;
         mc.soundTransform = st1;
    function on_stop_btn(e:MouseEvent):void
         mc.gotoAndPlay(1);
    mc.soundTransform = st1;
    This only mute the sound only and the sound is still runnung.

    The loaded external SWFs are AS3. The sound is on the timeline. Some SWFs use loaded sound, Here is its code:
    var snd:Sound = new Sound();
    var req:URLRequest = new URLRequest("moora.mp3");
    snd.load(req);
    So, how can I control the sound (Stop, Pause, resume).

  • Satellite P10-804: Cannot alter the sound volume control

    The Sound Volume Control on the front of the unit has set itself to far in the whole and cannot be altered.
    Is this something I can fix ?

    I dont know if you can fix it.
    Do you have enough experience to disassemble the notebook?
    Do you have good experience in soldering?
    The volume controller is fixed on the motherboard its not easy to say what happens maybe there are some loose contacts
    I think its better to contact a notebook technician because he has more experience as a common notebook user like me and you!

  • The sound of my iphone has dissapeared when I play games and when i listen to muisic but when I put the headphones the sound come back and I can control the sound,what should I do??

    I was on a boat ride when some water fell on it but it was just a little bit then when i tried to control the sound and volume while playing and listening to music it didn't showed anything and just with headphones it appeared again and i could listen and I could control it again but when i take the headphones out it goes back to the same thing.What should I do??

    try toggling the Ducking menuItem

  • The sound volume in the videoproject is too low

    Hallo,
    In Adobe Premiere Elements I3 made several projects. I used the tool Normalisation for the audio in a clip. Untill now this was functioning well. But at the present time I have a problem. Likely I have made a mistake with one of the settings. But I don't know which mistake.
    After the Normalisation of the sound in the clip the graphic rendition in the picture in the track Comment is as it should be.
    But the real sound is now too low. In the sound mixer I can see that the level of the sound doesn't come higher than -12 where it should actually be 0.
    I must have changed an overall setting somewhere with the result that the sound actually is too low.
    My question is: how can I restore the old situation where the sound volume was correct?
    Thank you in advance.
    Greetings,
    Hans van den Heuvel
    email: [email protected]

    Hans van den Heuvel
    My first impression of what you describe is this...
    1. If you were making audio adjustments with Clip Gain dialog, what happens if you bring up
    the Clip Gain dialog and change the value there from -12 to 0.0 dB for the audio clips whose values
    have gone from 0 to -12?
    More later.
    ATR

  • Is there an app that can control the ringer volume by the time of day?

    Is there an app that can control the ringer volume by the time of day. Like say i had work. Is there an app that can automaticly change the ringer volume on certain days at times you input to lower the ringer volume?

    Can a app like this be made or will apple not allow it?

  • How to adjust the sound volume in small increments in Mac OS 10.7 (Lion)?

    I use a Macbook that has dedicated sound volume buttons (F11 and F12).
    In Mac OS 10.6 I was able to adjust the sound volume in smaller increments (1/4th of a square) by pressing SHIFT + OPTION + VOLUME UP/DOWN.
    This stopped working after the update to 10.7. Any ideas?

    Unfortunately they did away with this feature in Lion.  Hard to understand why.
    You can with something like AudioHijackPro manage your System sound to a much higher degree. A very versatile piece of software.

  • Can I control the sound on users computer

    Hi
    I have a high school lab with 25 new intel iMacs. Is it possible to control the sound on the user computer so they can not use it. I have Mac server 4.10.10 and Apple Remote 3.0, etc. Any help would be appreciated.
    Perry

    Assuming you can't reset this by removing or locking the particular Sound settings in System Preferences via Workgroup Manager (WGM), then take a look at:
    http://discussions.apple.com/thread.jspa?threadID=1141459
    It's not exactly the same, but it might well point you at a solution.
    If you're just getting going with Macs in this particular environment, then you'll likely come to realize the Workgroup Manager and Server Admin tools are going to be your BFFs.

  • The sound volume

    The sound volume when I startup my computer always reverts back to a lower volume—even though I use the F12 key to increase the volume.
    Is there a way to set the volume so it remains at my desires setting after restarting the computer?
    Thanks.

    Hi Patn54,
    Welcome to the Support Communities!
    The article below may be able to help you with this issue.
    Click on the link to see more details and screenshots.
    Apple - Support - iPod nano - iTunes Troubleshooting Assistant
    http://www.apple.com/support/ipodnano/assistant/itunes/
    iPod troubleshooting basics and service FAQ
    http://support.apple.com/kb/TS1382
    Cheers,
    - Judy

  • How does KMDF driver control the master volume of Windows?

    Dear Sirs:
    I am developing a KMDF codec driver. 
    One of features is that the user can press buttons which are attached on a headset to manipulate the render volume.
    Is there any windows API available to allow me to control the master volume of Windows under KMDF developmnet?
    Thanks a lot.
    Sincerely, 
    Zale Yu

    Hi Doron,
    Thank you for pointing out the direction. Here please allow me to ask two questions, and also please review a possible solution.
    Question: 
    - may I ask for more details on how to do this underlying bus driver? i.e. could you kindly list a few steps on how to do this? 
    - Any related samples available in MSDN WDF I can look at to get th idea/even reuse the code? 
    Possibl solution:
    - how about claiming the codec device as a HID devic as well, and make a minidriver to pass through IRPs to filter driver which captures/interprets the button-press interrupt and then send HID report to change system volume? is this feasible?
    any conflict: Can Kernal add th driver (now Codec function Driver, Mini driver and a HID filter driver all together) stack together -- so the right driver can process the packet interested?
    Thanks again.
    JerryWang.xw

  • HT1849 hello i downloaded an album on my iPad yesterday but the sound volume is very low. Can you help me to fix the problem ?

    hello i downloaded an album on my iPad yesterday but the sound volume is very low. Can someone help me to fix the problem ?

    Hello Kishore1022,
    It sounds like you have a new album downloaded and the tracks all have a very low volume. I recommend checking to see if Sound Check is enabled in the Music settings.
    iPad User Guide
    http://help.apple.com/ipad/7/#/iPad99f37037
    Go to Settings > Music to set options for Music, including:
    Sound Check (to normalize the volume level of your audio content)
    You can also try downloading the purchases onto a computer, with either of these articles depending on your version of the operating system:
    iTunes 11 for Windows: Download previous purchases from the iTunes Store
    http://support.apple.com/kb/PH12491
    Or
    iTunes 11 for Mac: Download previous purchases from the iTunes Store
    http://support.apple.com/kb/PH12283
    Thank you for using Apple Support Communities.
    Cheers,
    Sterling
    Thank you for using Apple Support Communities.
    All the best,
    Sterling

  • AS3: How to access and control embedded sounds in an external swf?

    I rarely use sounds in AS3/Flash. I am using Flash Pro CS6, but I can't seem to figure out how to access, control (play, stop, etc) sounds embedded in an external SWF loaded into the main SWF.
    It's easy to control them when embedded on the main swf. However, on an externally loaded SWR, I get all kinds of errors. For this app, I really need to embed them in the external SWF.
    I read several solutions, but none seem to work.
    I embed the sound an mp3 file called soundSegment1.mp3 using Flash CS6 import tool and then open the actionscript properties panel on flash to select the class name: SoundSegment1. Then I edit the class code and create a file called SoundSegment1.as and it's saved right next to my document class main.as in the same directory. The code of the SoundSegment1 class looks like this:
    package  {
        import flash.media.*;
        public class SoundSegment1 extends Sound
            public function SoundSegment1 ()
                // no code in here
            public function playSound()
                var soundSegment1:Sound = new SoundSegment1();
                var channel:SoundChannel = soundSegment1.play();
    Then, in my main.as, I have done several attempts to play this sound such as:
    var fileLocation:URLRequest = new URLRequest(SWFToLoad); loader.load(fileLocation); loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressListener); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeListener); loader.contentLoaderInfo.addEventListener(Event.INIT, initListener); 
    function initListener(e:Event):void // I also placed this code on the completeListener and it didn't work {      loader.content.soundSegment1.playSound(); // doesn't work.  }
    I get:
    Line XXX 1061: Call to a possibly undefined method playSound through a reference with static type flash.display:DisplayObject.
    or, I also read that I should be able to do something like this anywhere in the Main.as file:
    var theClass:Class = Class(loader.content.getDefinitionByName("SoundSegment1")); var theSound:theClass = new theClass(); theSound.play()  //doesn't work either.
    I also tried on the completeListener:
    var TheClass:Class = e.target.applicationDomain.getDefinition("SoundSegment1") as Class; var theSound:TheClass = new TheClass();
    theSound.play()  //doesn't work either.
    I get:
    ReferenceError: Error #1065: Variable SoundSegment1 is not defined. at flash.system::ApplicationDomain/getDefinition()
    I am stuck and I really need to get this to work. I would be genuinely grateful for your help.
    Thank you in advance for any help provided. I really need to get it to work, because I can't simply embed them in the main SWF or load them individually externally one by one.
    Thanks again!

    THANK YOU!
    I think your code may be over my head though. I think you are using an anonymous function which is not something I am familiar with (but I want to learn about if it's useful).
    I also don't know where the classS came from. I see that it's a parameter sent along with the event, but I don't really see where that came from.
    Someone at: http://www.kirupa.com/forum/showthread.php?305098-Playing-a-embedded-sound-in-an-external- swf&p=2658098#post2658098
    Is showing what seems to be an easier solution, but my problem there is I can't access the source file of the "child" swf....  ayayay.....
    I am going to tinker with your solution and see if it gets me anywhere. Thanks so much for your help again.

  • Change the sound volume increment?

    Is there a way to change how much the Apple remote and keyboard increments/decrements the system sound volume?
    Let me explain... I have the Bose Companion 5 sound system. It comes with a little desktop controller to adjust and mute the volume. The desktop volume controller is nice and all, but it's completely independent from the Mac OS volume controls. I could crank the Bose control all the way up, but doing so makes it such that even the lowest Mac OS volume setting is still louder than I'd like (easily audible through the walls), and quiet white noise is heard even if the Mac is muted. Setting the Bose volume to something in the middle or lower limits my volume flexibility when listening to music and I come across that occasional song that I want cranked louder. I know I'm whining, but hear me out.
    I recently bought a new desk and made an interesting discovery while setting everything back up. Somehow I had forgotten to connect the Bose volume controller. When I grabbed the Apple remote to adjust the system volume, it seemed to directly adjust the volume on the Bose system (this setup can get VERY loud this way), and no white noise when the Mac is muted. I love the idea of leaving it like this, but even the first notch above mute (via keyboard or remote) is pretty loud. Finite control is possible from the volume preferences panel, but who wants to open that every time to change the volume?

    I don't know if these two AppleScripts will help you or not but give them a try.
    Place them in your Applications folder or your AppleScript folder (within your Applications folder), then drag them into your Dock.
    They are background scripts so you will not see them launch in the Finder.
    Have iTunes playing or some other app playing when you test them.
    Download: <http://tomx.890m.com/VUpDown.dmg>
    Tom

  • Volume control sometimes gets stuck controlling the wrong volume - bug report?

    Occasionally the volume control hard buttons on my Pre go wonky and "stick" to controlling an application as opposed to what they are supposed to. For example, I'll use the music player, and it will function fine and show the musical note when adjusting the volume. Then I'll toss away the music player app, but the volume will "stick" with the musical note and not control the system and ringer sound volumes.
    This feels like a bug, but I might be missing something. Thanks!
    Post relates to: Pre p100eww (Sprint)

    Don't think your missing anything. Its a bug, I have encountered a few times. Seems like most the time, it has happened to me if I immediately try to change the volume after tossing a card away such as music player, or video. But have had it happen a few times without any explanation. Restarting it fixes it, and luckily it does not happen that often for me. Just wanted to chime in to say its not just you though.

  • Is there a way to adjust the sounds' volume withou...

    I have an annoying problem with my Skype:
    The volume of the other person is perfectly fine, but the volume of the sounds for calls is just too high. Like hurting my ears too high.
    Is there a way to adjust these sounds without changing the other person's volume?
    Solved!
    Go to Solution.

    Not as far as I know. I have self, for the same reason set the Volume of Skype to about 40% and I don't see any effect on the call volume. Only ringing and notification sounds are affected.

Maybe you are looking for