Hi all,

        I have a slight problem with the sound object and the Timer class. I
have a movie that loads sounds dynamically at random intervals. it works
perfect until the movie is reset.
        Basically the user gets to stop the sounds and start all over. and
it starts fine until you reach the point where they left off before, say you
played sound 1, 2 and 3 was in cue when you stoped the movie, well next time
arround when the movie starts playing when it reaches sound 2 it starts
playing sound 3 at the same time, then the rest over lap 3 with 4 and 4 with
5 and so forth.

        Here is a snippet of the class....


        var soundDelayed     : Object     ;
        var sTimer             : Timer     ;

        private function playSectionSound ( sound : Object , delay : Number
= 0  ) : void

        {



            if (delay > 0 )

            {
                soundDelayed = sound ;
                sTimer= new Timer(( delay ), 1);
                sTimer.start();
                sTimer.addEventListener(TimerEvent.TIMER, sTimerHandler);

            } else {
                soundDelayed = sound;
                playVoiceOver ( soundDelayed ) ;

            }

        } ;

        private function playVoiceOver ( vo : Object )

        {
        trace("PLAY VOICE OVER = " + vo)
            volumeChannel = vo.play();

                var transform    : SoundTransform ;
                transform = channel.soundTransform;

                if (volumeStatus == "off")

                    {

                        transform.volume = 0;
                        volumeChannel.soundTransform = transform ;

                    }

        } ;

Down the line to kill everything i call the following:

    sTimer.stop();
    sTimer.reset();
    sTimer.removeEventListener(TimerEvent.TIMER, sTimerHandler);
    soundDelayed = null

    and it seems to work until the sound overlaps...

    suggestions? TIA
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to