Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7029987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:36:40+00:00 2026-05-28T00:36:40+00:00

I have this problem when I try to fade in sound with the function

  • 0

I have this problem when I try to fade in sound with the function below. It just doesn’t work and I can’t figure out where the problem is.
I would like to fade in a looping sound but nothing happens. I appreciate any hint I can get to solve this problem. Thanks in advance.

this is used to play a sound via events

dispatchEvent(new CustomEventSound(CustomEventSound.PLAY_SOUND, Main.SOUND_AMBIENT, false, true, false, 999999, 0, 0, setSoundVolume));

this is the function to play a sound. the stop-function is almost identical to this one.

public function playSound(soundName:String, isSoundTrack:Boolean = false, fadeIn:Boolean = false, fadeOut:Boolean = false,
                              loops:int = 1, offset:Number = 0, volume:Number = 1):void {

        if (fadeIn) {
            tempSoundTransform.volume = 0;
        } else {
            tempSoundTransform.volume = volume;

        }
        tempSound = sounds[soundName];

        if (isSoundTrack) {
            if (soundTrackChannel != null) {
                soundTrackChannel.stop();
            }

            soundTrackChannel = tempSound.play(offset, loops);                              
            soundTrackChannel.soundTransform = tempSoundTransform;

            if (fadeIn) {
                for (var i:int = 0; i < fadeInInc; i++) {
                    tempSoundTransform.volume += 1 / fadeInInc;
                    soundTrackChannel.soundTransform = tempSoundTransform;  
                    if (tempSoundTransform.volume >= 1) {
                        tempSoundTransform.volume = 1;

                    }
                }
            }

        } else {
            soundChannels[soundName] = tempSound.play(offset, loops);
            soundChannels[soundName].soundTransform = tempSoundTransform;

            if (fadeIn) {
                for (var i:int = 0; i < fadeInInc; i++) {

                    tempSoundTransform.volume += 1/fadeInInc;
                    soundChannels[soundName].soundTransform = tempSoundTransform;   
                    if (tempSoundTransform.volume >= 1) {
                        tempSoundTransform.volume = 1;

                    }

                    trace("tempSoundTransform.volume " + tempSoundTransform.volume);
                }
            }

        }

    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T00:36:41+00:00Added an answer on May 28, 2026 at 12:36 am

    I think your problem is caused by “for” statements. Program will wait while for statement will end and set values after that. If you want to increase volume value parallely you should do it on ENTER_FRAME event or try Sounds fade in/out with ActionScript 3

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this problem, my code doesn't work when i try to find eyes
I have this problem when i try to synchronize a observable list with listbox/view
So I have this problem with strings and switch-case, and I'll try to keep
I have been puzzling over a problem this morning with LinqToSQL. I'll try and
I have this problem then I try to float div left, each block contains
I have this problem when I try to getDefinitionByName('some_var_by_class_linkage') . But I have such
i have this problem: as i can add list to one list? i have
I have this problem when I try to use script/generate: $ script/generate start /Users/gst/.gem/ruby/1.8/gems/hpricot-0.8.1/lib/fast_xs.bundle:
I have been working through some code and I would like to work out
I have this problem: When I try to implement Ayende's complex searching found at:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.