Skip to main content
Participant
March 25, 2013
Question

Sync Sound with Animation

  • March 25, 2013
  • 1 reply
  • 481 views

I created my first Flash CS6 AS3 program "pacman" during my 30 day trial - which just ended. It works on my desktop, but the sound lags when it's on a server. I declare the variables. Later I assign them. I then play the sound by calling a function with paramater "1".  (There are several sounds, the examples below just show the code for the Begining music).

Is there some online documentation that could help me properly implement sound in my app, or is there a simple way to sync the sounds to the animation?

Thanks for all.

G.Doucet

        // Sound Variables

        private var sndBegin:Sound=new Sound();

        private var chBegin:SoundChannel=new SoundChannel();

        var req:URLRequest=new URLRequest("pmBegin.mp3");        // Load music into variables

        sndBegin.load(req);

        public function spBegin(p1:int) {

            if (p1 == 0) { chBegin.stop(); }                         //--------Stop Music

            else { chBegin=sndBegin.play(); }                        //--------Start Music

        }

This topic has been closed for replies.

1 reply

Inspiring
March 25, 2013

It is extremely difficult to sync animations with external streaming assets. You are better off embedding sound into timeline - this will assure complete sync.