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

Sound Transform not working

Explorer ,
Apr 18, 2013 Apr 18, 2013

Hey guys,

I'm getting this silly little problem. I'm making a sound play and I'm trying to change it's volume. I've done this many times before and got it to work, but in this script for some reason it's not working. The script looks like this :

package {

    import flash.media.Sound;

    import flash.media.SoundChannel;

    import flash.media.SoundTransform;

    public class Main

    {

        var createSound:Create;

        var createChannel:SoundChannel;

        var createTransform:SoundTransform;

        public function Main()

        {

            createSound = new Create();

            createChannel = new SoundChannel();

            createTransform = new SoundTransform();

            createTransform.volume = 0.5;

            createChannel.soundTransform = createTransform;

            createChannel = createSound.play();

        }

    }

}

For some reason, it plays the sound, but at full volume no matter what value I put in the createTransform.volume variable. I've gotten almost the same exact code working in other games I've made, I dunno why it isn't working in this one

TOPICS
ActionScript
529
Translate
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

Community Expert , Apr 18, 2013 Apr 18, 2013

try:

package {

    import flash.media.Sound;

    import flash.media.SoundChannel;

    import flash.media.SoundTransform;

    public class Main

    {

        var createSound:Create;

        var createChannel:SoundChannel;

        var createTransform:SoundTransform;

        public function Main()

        {

            createSound = new Create();

            createChannel = new SoundChannel();

            createTransform = new SoundTransform();

            createTransform.volume = 0.5;

// in this order

          

...
Translate
Community Expert ,
Apr 18, 2013 Apr 18, 2013

try:

package {

    import flash.media.Sound;

    import flash.media.SoundChannel;

    import flash.media.SoundTransform;

    public class Main

    {

        var createSound:Create;

        var createChannel:SoundChannel;

        var createTransform:SoundTransform;

        public function Main()

        {

            createSound = new Create();

            createChannel = new SoundChannel();

            createTransform = new SoundTransform();

            createTransform.volume = 0.5;

// in this order

            createChannel = createSound.play();

createChannel.soundTransform = createTransform;

        }

    }

}

Translate
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
Explorer ,
Apr 18, 2013 Apr 18, 2013

haha I'm an idiot, thanks kglad!

Translate
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
Community Expert ,
Apr 18, 2013 Apr 18, 2013
LATEST

(welcome to the club - and, you're welcome.)

Translate
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