How to synchronise animation between multiple Flash Player instances
Here I've got three instances of the Flash Player, laid out roughly in HTML. They are different interactive animations, based on the same content and behaviour, that respond to mouse movement. But as the user interacts with one, we need to keep the others 'in sync'. But the obviously solution, using a local SharedObject and continuously reading and writing to it, is too harddrive intensive - so much for caching.
So, to do this, I use the LocalConnection, connecting the SWFs in a looped event chain (1 to 2, 2 to 3, 3 to 1). Whichever SWF has mouse over sends out update packets through the LocalConnection. But to stop an infinite loop of updates being passed around the chain, the packets expire (they have a TTL, like internet data packets). In the demo below, a red box pops up in the SWF which is sending out data, a green box on those SWFs receiving updates (which much also be passed on down the chain). Lastly, each instance is given an X and Y 'offset', to make the elements' positions match up visually, whereever you lay out the SWFs on the page. Here's the source - sorry, it's AS2 since this technique was used for banners.