Here's a little AS2 code that I wrote that illustrates the principle of putting in a delay.
Instead of playing a sound, I start and stop an animation (it was quicker to set that up than find a sound to play!).
There's a button that, on click, does a bunch of things:
1. it stops the animation (stops the sound)
2. it launches the external EXE via fscommand
3. it starts an onenterFrame loop that increases the counter until it reaches an arbitrary maximum time (in this case, 100).
When we hit that 100th frame, the onMouseMove event handler is created.
So after 100 frames of delay, when you move the mouse, the animation will play again (the sound will play in your case).
I'll be the first to admit that this code could certainly be cleaner, and if you're using AS3, you need to be more formal with your event registration, but this quick n dirty hack should get you through.
I'm going to follow this up with a SharedObject example, more for my own elucidation than anything else.
T
Main Topics
Browse All Topics





by: tomaugerdotcomPosted on 2008-06-07 at 05:41:24ID: 21735237
The problem is that you're dealing with two separate EXEs. If there is any way to have the second movie play INSIDE the first movie, that would solve all your problems.
flash/8/ma in/wwhelp/ wwhimpl/co mmon/ html/ wwhelp.htm ?context=L iveDocs_Pa rts&file=0 0001562.ht ml
loper/acti onscript/ m oviecliplo ader.htm
This would be based on the standard process of loading an external SWF (not EXE) into your main projector.
There is a lot of examples of this online:
http://livedocs.adobe.com/
http://www.kirupa.com/deve
Okay, but I'm assuming you knew this already and there's a very specific reason why you must use two separate EXEs. Because of that, there's no way that I know of that one EXE can communicate with the other, unless you use sharedobjects (more on that later).
A very quick, very easy example would be to use some kind of delay. Only activate the onMouseMove event listener AFTER a certain amount of time has elapsed, so that gives the other EXE time to open in front of the first.