Quantcast
Channel: Adobe Community : Discussion List - Using Flash Builder
Viewing all articles
Browse latest Browse all 1802

AS3 volume slider code not working

$
0
0

I added a volume slider that slides back and forth work but it doesn't change the volume. Am I doing it wrong or missing code? I am streaming different audio on each frame.

 

Here is the code on the main timeline:

 

SoundMixer.stopAll();

var pP1:Number = 0;//playback position

var playing1:Boolean = false;

 

 

var mySound1:Sound = new Sound();

var myChannel1:SoundChannel = new SoundChannel();

mySound1.load(new URLRequest("Physiology Slide 01 INTRO.mp3"));

myChannel1 = mySound1.play();

 

 

SoundMixer.stopAll();

 

 

function EnterFrame(event:Event):void {

 

 

//chnange volume if the drag the volume slider

  var volumeLevel = myChannel1.soundTransform;

  var newLevel:Number = volumeSlider.slideKnob.x / 100

  volumeLevel.volume = newLevel;

  myChannel1.soundTransform = volumeLevel;

}

 

 

PlayPause1_btn.addEventListener(MouseEvent.CLICK, togglePlay1);

togglePlay1(null);

 

 

function togglePlay1(event:MouseEvent):void {

playing1 = !playing1;

if (playing1) playS1();

else pauseS1();

}

 

function playS1() {

myChannel1 = mySound1.play(pP1);

PlayPause1_btn.gotoAndStop(1);

}

 

function pauseS1() {

pP1 = myChannel1.position;

myChannel1.stop();

PlayPause1_btn.gotoAndStop(2);

}


Viewing all articles
Browse latest Browse all 1802

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>