View Full Version : JS to stop / start 2 SWF's simultaneously?

06-20-2011, 08:43 PM
I have 2 SWF files on the same webpage:

SWF1 is an audioplayer
SWF2 is a moving graphic

I want SWF2 to start and stop simultaneously with SWF1:
When the musicplayer is pressed to start, the graphic starts too.
And when the musicplayer is pressed to stop, the graphics stops as well.

Can this be done using javascript? If so, where to find working code?
Ive spent hours on google with no result. Any help or comment appreciated

06-20-2011, 08:51 PM
Yes it can, assuming you have the working files to the SWF.

You'll need to look into flash.external.ExternalInterface.

06-20-2011, 08:54 PM
Then again... You're working with two SWF files you don't need to use JavaScript.

Read this: http://www.ahrooga.com/entry/how-to-communicate-between-multiple-flash-files-with-localconnection/

06-20-2011, 09:12 PM
Thx for reply. Yes i read about LocalConnection which would be an ideal solution.

Unfortunately i only have the FLA file for the graphic. The audioplayer is freeware recommended by Gentleone in a previous string in this forum. Working well and easy to customize by the way.

So if i understand it correctly, i cant use LocalConnection since a "receiver" and "sender" must be implemented while creating both SWF's?

06-21-2011, 01:53 PM
Issue solved in HTML / CSS by stacking two div with different z-index and top div postion:absolute.

Bottom div contains the graphics which is hidden by startbutton from Audioplay.
When startbutton is pressed the stopbutton is released; stopbutton is a PNG which allow the graphics contained in bottom div to shine through.

No js needed afterall; CSS and a couple of hours of sleep solved the issue..