The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.


Results 1 to 2 of 2

Thread: As3 equalizer & volume control help needed!

  1. #1

    As3 equalizer & volume control help needed!

    I was wondering if somebody could help me adding an equalizer and volume control for the following code.

    Code:
    //number that is redefined when the pause button is hit
    var stopPoint:Number = 1;
    //a true or false value that is used to check whether the sound is currently playing
    var isPlaying:Boolean;
    
    //think of the soundchannel as a speaker system and the sound as an mp3 player
    var soundChannel:SoundChannel = new SoundChannel();
    var sound:Sound = new Sound(new URLRequest("demo.mp3"));
    
    
    //you should set the xstop and xplay values to match the instance names of your stop button and play/pause buttons
    xstop.addEventListener(MouseEvent.CLICK, clickStop);
    xplay.addEventListener(MouseEvent.CLICK, clickPlayPause);
    
    
    soundChannel = sound.play();
    isPlaying = true;
    
    function clickPlayPause(evt:MouseEvent) {
        if (isPlaying) {
            stopPoint = soundChannel.position;
            xplay.gotoAndStop(2);
            soundChannel.stop();
            isPlaying = false;
        } else {
            soundChannel = sound.play(stopPoint);
            isPlaying = true;
            xplay.gotoAndStop(1);
        }
    }
    
    function clickStop(evt:MouseEvent) {
        if (isPlaying) {
            soundChannel.stop();
            isPlaying = false;
        }
    
    }

  2. #2
    Ok i managed to create the volume control, but is not working, can somebody help me with it.
    Here is my code.

    //number that is redefined when the pause button is hit
    var stopPoint:Number = 1;
    //a true or false value that is used to check whether the sound is currently playing
    var isPlaying:Boolean;

    //think of the soundchannel as a speaker system and the sound as an mp3 player
    var soundChannel:SoundChannel = new SoundChannel();
    var sound:Sound = new Sound(new URLRequest("http://176.9.42.221:8000/;"));


    //you should set the xstop and xplay values to match the instance names of your stop button and play/pause buttons
    xstop.addEventListener(MouseEvent.CLICK, clickStop);
    xplay.addEventListener(MouseEvent.CLICK, clickPlayPause);


    soundChannel = sound.play();
    isPlaying = true;

    function clickPlayPause(evt:MouseEvent) {
    if (isPlaying) {
    stopPoint = soundChannel.position;
    xplay.gotoAndStop(2);
    soundChannel.stop();
    isPlaying = false;
    } else {
    soundChannel = sound.play(stopPoint);
    isPlaying = true;
    xplay.gotoAndStop(1);
    }
    }

    function clickStop(evt:MouseEvent) {
    if (isPlaying) {
    soundChannel.stop();
    isPlaying = false;
    }

    }

    //Volume Control//
    var volumeLevel = soundChannel.soundTransform;
    var newLevel:Number = volumeSlider.sliderKnob.x / 100;
    volumeLevel.volume = newLevel;
    soundChannel.soundTransform = volumeLevel;

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012