• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

AS3 volume slider code not working

Explorer ,
Apr 23, 2016 Apr 23, 2016

Copy link to clipboard

Copied

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);

}

Views

626

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Apr 23, 2016 Apr 23, 2016

Votes

Translate

Translate
Explorer ,
Apr 23, 2016 Apr 23, 2016

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
May 16, 2016 May 16, 2016

Copy link to clipboard

Copied

LATEST

Moving to Using Flash Player

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines