Jump to content
Search Community

getting a sound to start at 15 seconds

timaging test
Moderator Tag

Recommended Posts

Hi,

 

I'm trying to get a sound event to play at around 15 seconds. I have the header code in there:

import com.greensock.*;
import com.greensock.easing.*;
import com.greensock.plugins.*;
import com.greensock.OverwriteManager;
TweenPlugin.activate([VolumePlugin, MotionBlurPlugin, TintPlugin, BlurFilterPlugin]);
import flash.media.Sound;
import flash.media.SoundChannel;

OverwriteManager.init(OverwriteManager.AUTO);

var sound:Crunches = new Crunches();
var chompSound:SoundChannel = sound.play();

 

and I have my sound labelled:

post-6318-133152001678_thumb.jpg

 

and then I have my code in timelineMax:

var yourtimeline:TimelineMax = new
TimelineMax({repeat:0,onComplete:myFunction});


yourtimeline.insert(new TweenMax(chompSound, 0, {volume:1, delay:15}));

 

I'm reading through the Flash docs and tried to do sound.stop(); but that crashed flash. I don't see a way to set volume to 0. No matter what I do, the sound plays at the beginning.

 

Is there a way to do this?

 

thanks,

dave

Link to comment
Share on other sites

the following will fade a sound in over 1 second after a 3 second delay. you can call myFunction however you like, for the onComplete of a TimelineMax, TweenMax, delayedCall... whatever

 

var sound:Crunches = new Crunches();
var chompSound:SoundChannel;

TweenLite.delayedCall(3, myFunction)

function myFunction(){
chompSound = sound.play();
TweenMax.fromTo(chompSound, 1, {volume:0}, {volume:1})
}

 

sound.stop() won't work as stop() is a method of SoundTransform, not Sound. could they make this more confusing? :shock:

this helps a lot: http://www.republicofcode.com/tutorials/flash/as3sound/

Link to comment
Share on other sites

geez... no wonder. I was looking specifically at the Adobe AS 3 sound page, because I never would have thought that just the greensock code would do it. I gotta figure out a way to wrap my head around all this. Just when I think I'm getting the hang of it, something else comes up!

 

 

thanks again for your help-

Dave

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...