Jump to content
GreenSock

gerrydesign

Help: play MP3loader object from TweenMax onStart parameter

Recommended Posts

I'm trying to play a sound effect by calling a function from an onStart parameter of TweenMax. I wanted the sound to play on every timeline.append I listed but it only play once. Code goes:

 

private var sound:MP3Loader;

...

sound = new MP3Loader("audio/on.mp3", {name:"flare", autoPlay:false, estimatedBytes:12000});

...

timeline.append(new TweenMax(CD["faceplate"], 0.25, {alpha:.5, rotationX:0, onStart:toggleSound}));

timeline.append(new TweenMax(CD["eye_socket"], 0.25, {alpha:0.6,rotationX:0, y:CDy["eye_socket"], onStart:toggleSound}));

timeline.append(new TweenMax(CD["tab_right"], 0.45, {alpha:0.6,y:CDy["tab_right"], ease:Bounce.easeInOut, onStart:toggleSound}), -.25);

timeline.append(new TweenMax(CD["tab_left"], 0.45, {alpha:0.6,y:CDy["tab_left"], ease:Bounce.easeInOut, onStart:toggleSound}), -.25);

...

 

private function toggleSound():void {

sound.playSound();

}

 

I might be missing something here so any help will be appreciated. Thanks in advance!

 

Gerry

Link to comment
Share on other sites

If you just playSound(), it keeps advancing...if you want to start over each time, do gotoSoundTime(0, true);

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.
×