Link to home
Start Free TrialLog in
Avatar of Hamlet081299
Hamlet081299

asked on

In Flex how can I synchronise movement and sound

I'm writing a flex app, and hit a bit of a snag.  One of those things that you expect to just work - but it doesn't.

One of the visual elements is a drawer.  It can be opened and shut.  When it opens it should make a whoosh sound and when it closes it should go whoosh-clunk.

The drawer itself is just a simple element, and it is opened by using a mx.effects.Move.

The sounds are preloaded, so there should be no delay.

The code looks something like...

            _snd.play();
            
            _move.duration = _snd.duration;
            _move.xTo = newx;  
            _move.play();

Notice that I call the sound play FIRST, but whenever the drawer opens or shuts the movement happens first and then the sound.  Actually to be more precise there is a delay of approximately one second between when the movement starts and when the sound starts.

One second may not seem much.  But given that the whole thing is supposed to happen in about 0.5 seconds - then it is a lot!

I've tried using both mx.effects.SoundEffect and flash.media.Sound for the sound, but the result is the same.

Does anyone know a way to synchronise the two, or perhaps why there is the initial delay?

Any ideas appreciated.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Hamlet081299
Hamlet081299

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial