dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Please help problem with sound

  1. #1
    Senior Member
    Join Date
    Dec 2002
    Posts
    156

    Please help problem with sound

    I'd really appreciate some help with teething problems on sound actionscript.

    I have two background music's, which i'd like to fade out on change. I'm using the Sound Fade Object Extension from Remixology, recommended in the FAQ thread in this forum to fade out my sounds. Then I noticed that I need to make the next sound wait a little (until the fade has finished) before starting otherwise remixology doesnt like it. So I made a wait function. (Remixology)

    Whilst my use of it is 'ok' when making slow transitions between frames, if I quickly click back and forward it causes all sorts of issues. The bg music supposed to start for frame 3 (then cancelled on move back) starts on frame 2. Sometimes the bg sound will start about 6 times on top of itself which makes a horrible droaning noise.

    I've put the code i'm using below, and would really appreciate anyones time to have a look for me:

    Frame 1
    Code:
    function wait(soundName:String) {
    mysound = new Sound();
    mysound.attachSound(soundName);
    mysound.start(0, 999999);
    clearInterval(waitInt);
    }
    
    // add extension located in this directory at compile time
    #include "soundobjectfade.as"
    
    attachMovie("sound", "sound", 6);
    
    // initiate sound
    bandofbrothers = new Sound();
    bandofbrothers.attachSound("bandofbrothers");
    bandofbrothers.start(0, 999999);
    
    fromintro = true;
    Frame2
    Code:
    if(!fromintro){
    		waitInt = setInterval(wait,5000, "bandofbrothers");
    }
    
    btnNextFrame.onPress = function () { // When button is pressed
    	gotoAndPlay("frame 3") // Go to frame 3 (below)
    	bandofbrothers.fadeToStop(0,4000); // fade volume from 100 to 0 over 4 seconds and stop sound.
    }
    Frame 3
    Code:
    enemyatgates = new Sound();
    enemyatgates.attachSound("enemyatgates");
    waitInt = setInterval(wait,5000, "enemyatgates");
    
    btnBack.onPress = function () { // When button is pressed
    	gotoAndPlay("menu") // Go to Menu screen
    	enemyatgates.fadeToStop(0,4000); // fade volume from 100 to 0 over 4 seconds and stop sound.
    	fromintro = false;

  2. #2
    Senior Member
    Join Date
    Dec 2002
    Posts
    156
    I'm still suffering this issue, can anybody help me out?

  3. #3
    dubba you tee eff steven_h_2000's Avatar
    Join Date
    Oct 2000
    Location
    Columbus, Ohio
    Posts
    137
    can you provide an fla/zip file with fla and as files? or at least the swf so that we could view the issue? because it is slightly difficult to decide what the problem is based only on the code

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center