Solved

In Flex how can I synchronise movement and sound

Posted on 2009-05-04
1
284 Views
Last Modified: 2012-05-06
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
0
Comment
Question by:Hamlet081299
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 5

Accepted Solution

by:
Hamlet081299 earned 0 total points
ID: 24301510
UPDATE

As I mentioned the sounds are preloaded.  In other words I am loading these sound files (MP3) at the start of the application.  For technical reasons I prefer not to embed them.

BUT when I tried embedding them, they worked correctly.  

I'm guessing that maybe when you embed sound into a SWF it is transcoded.  But when loading dynamically it is doing the transcoding every time I try to play the sound, and this is what causes the delay.

I could perhaps embed the sounds into a separate file, but would prefer to stay with the dynamic load if possible.  Can anyone suggest a way to force the transcode prior to playing a sound?
0

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
flex simple crossdomain problem 1 850
regular expression:- validate string of numbers 1 427
Dashboard Examples 1 593
FlashBuilder allocate more memory using FlashBuilder.ini 18 279
First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
This article was originally published on Monitis Blog, you can check it  here . If you have responsibility for software in production, I bet you’d like to know more about it. I don’t mean that you’d like an extra peek into the bowels of the sour…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question