2 Replies Latest reply on Mar 2, 2007 12:12 PM by vectorg6

    Help with Volume Slider

      Im looking for an example of a volume slider that controls the volume of the swf loaded into the swfLoader.
      I have tried the SoundTransformExample http://livedocs.adobe.com/flex/2/langref/flash/media/SoundTransform.html but was unsuccessful at getting it to do anything. I didnt get any errors but it didnt play the mp3 either. I was going to use that to work from. I coded 2 volume sliders in AS1 and AS2 but im struggling to fugure this out in AS3. Thanks for any examples.
        • 1. Help with Volume Slider
          vectorg6 Level 1
          This is the code I have come up with. I dont know how close I am but I gave it a shot.
          I get the error:
          TypeError: Error #1009: Cannot access a property or method of a null object reference.
          Meaning its not finding the swf or any sound to play. I dont want to just play an mp3 and Im not sure how to reference this sound in the loaded swf via the swfLoader. Thanks for any help.

          In the folloing (failed) example I used mySWF.swf as the place holder for your own SWF.

          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">

          import flash.events.*
          import mx.controls.SWFLoader;
          import mx.events.SliderEvent;
          import mx.controls.sliderClasses.Slider;
          import flash.media.SoundTransform;
          import flash.media.Sound;
          import flash.media.SoundChannel;

          private var soundFactory:Sound;
          private var channel:SoundChannel;

          public function SoundTransformExample() {
          soundFactory = new Sound();


          private function setVolume(volume:Number):void {
          trace("setVolume: " + volume.toFixed(2));
          var transform:SoundTransform = channel.soundTransform;
          transform.volume = volume;
          channel.soundTransform = transform;

          private function eventSliderChange(event:SliderEvent):void {
          var value:Number;
          var volume:Number = Math.round(VolumeSlider.value);

          <mx:SWFLoader top="10" bottom="50" right="10" left="10" id="swfldr" source="mySWF.swf"/>
          minimum="0" maximum="100"


          <mx:TextArea id="thumbLive"
          fontSize="10" color="#575757"
          bottom="10" left="414"
          width="160" height="21"/>

          • 2. Help with Volume Slider
            vectorg6 Level 1
            Anyone Anyone Is there no example online of a working volume slider?