On our recent push-down banner for The Dominion Plaza development, we came to a slight stumbling block in communicating between each panel to synchronise the animation. The documentation was slightly patchy so here’s a basic rundown of how we achieved this effect on the eyeblaster platform.
Eyeblaster have a “SyncAds” component that uses the LocalConnection class to communicate between your panels – or ads on the same page – and allows you to run functions. As LocalConnection isn’t available to you on the eyeblaster platform, this proxy class is your best bet.
Usage is relatively simple: register a connection, create a listener to find the panel’s connection and execute the function on the panel when it loads. For the steps below the banner is the “sender” and the panel is the “receiver”. This effect can be used to great effect with multiple ads on the page.
First off, place your SyncAds component in the second frame of your banner (and your panel) and give it an instance name – I’ve called mine “syncAd_mc”. Create a function in the root, first frame of the overlay/push-down panel to handle the data passed from the banner. For this simple example we’re simply passing a frame number to move to, but you’d probably want to do more than this.
function gotoFrame(iFrame:Number) {
gotoAndPlay(iFrame);
}
And in frame 2 of your panel:
syncAd_mc.openConnection("panel");
You can see that we always have to open a connection with the openConnection method of the syncAds component. This is required before any communication can be made between panels.
Now, on the rollover event of your banner, use the findConnection method of your SyncAds component to listen for the panel opening (there will be a delay before the panel opens depending on connection speed etc. of the user).
syncAd_mc.openConnection("banner");
clickthrough.onRollOver = function() {
syncAd_mc.findConnection("panel");
}
syncAd_mc.onConnectionFound = function() {
syncAd_mc.callConnection("panel", "gotoFrame", _currentframe);
}
The onConnectionFound event handler is called when the panel has loaded and the function “gotoFrame” is called, passing the currentframe of the banner.
It’s pretty easy when you get down to it!