Search code examples
flashactionscript-2flash-cs4synchronization

ActionScript2: How to make 2 flash banners start playing at the same time?


I have 2 flash banners (using ActionScript 2) on my web page, how can I make them start playing at the same time, after the page has fully loaded?

Both .SWF files are embedded in HTML using the script provided by Adobe on object export.

I created both in Flash CS4, but I have very little knowledge of flash, so please explain it thoroughly if you can (and excuse my lack of flash knowledge).

Thanks in advance.

Edit: I read about "LocalConnection", but I have no idea how to implement it in flash.


Solution

  • Normally, LocalConnection in ActionScript or a combination of JavaScript and ActionScript, using the ExternalInterface mechanism in ActionScript, would be the recommended way to synchronize two Flash instances.

    But since you say you have little knowledge of Flash, I guess you could keep the ActionScript and Flash part to a minimum and make use of the more or less deprecated JavaScript API for the Flash Player described is this (about 10 year old) page:

    http://www.adobe.com/support/flash/publishexport/scriptingwithflash/scriptingwithflash_03.html

    In short, what you would do is make it so the swf files would not play automatically, by issuing a stop() command in ActionScript in your Flash files, and later start them from JavaScript using calls like:

    swf1.Play();
    swf2.Play();
    

    Again, in general, I wouldn't recommend using that old API, designed for Flash content produced about 10 years ago, for Flash Player 5, long before ExternalInterface existed, but under these particular circumstances, it may come in handy.