Info

Adform Local Connection component ensures the proper performance of Adform Synchronized Banners. It provides a ready functionality and allows communication between any number of banners linked via LocalConnection. Auto-complete is supported for this component.

Note: Only the ActionScript 3.0 version is supported.

Methods

  • sendTo(channelName, methodName, params) - Sends a message to the specified channel.
  • sendToAll(methodName, params) - Sends message to all the target channels.
  • logEnabled - Enables/Disables debug log messages. Default value is false.
  • logLevel - Changes a log level. Use 0 for the basic information and 1 for the verbose logging. Default value 0.
  • targetChannels - Returns an array of target channels to which this asset will be sending messages (Get only).
  • channel - Returns a channel name on which this asset will be listening for messages (Get only).
  • addEventListener(type, handler) - Adds an event listener.
  • removeEventListener(type, handler) - Removes an event listener.

Note: All methods can be accessed via static AdformLocalConnection class methods calls, e.g. AdformLocalConnection.sendTo('myChannel', 'myMethod', 'myParam1', 'myParam2');

Note: AdformLocalConnectionEvent.CHANNEL_READY or AdformLocalConnectionEvent.READY must be fired before any communication attempts via sendTo() or sendToAll().

Events

  • AdformLocalConnectionEvent.CHANNEL_READY - Fires when one of the channels is ready to communicate.
  • AdformLocalConnectionEvent.READY - Fires when all the target channels are ready.

Component properties

  • channel - name of a channel on which this asset will be listening for messages, e.g. myChannel.
  • client - object that exposes callable methods for this channel. You only need to change this if your code is in another object than the AdformLocalConnection component.
  • targetChannels - target channels separated by , to which this component will be sending messages, e.g. a_channel,b_channel,c_channel.
  • logEnabled - enables/disables debug log messages. Default value false.

Example

//------------------------
// alpha.swf
//------------------------

// define any user-function to be called via RFC (remote function call)
function potato():void {
    trace("hello world");
}

//------------------------
// beta.swf
//------------------------

// add a listener to wait for all remote channels specified in "Target Channels" to be available.
AdformLocalConnection.addEventListener(AdformLocalConnectionEvent.READY, onConnectionReady);

function onConnectionReady(event:AdformLocalConnectionEvent):void {
    // since all target channels are ready, alpha.swf is ready and channel "alpha" is open for RFC.
    // call remote function
    AdformLocalConnection.sendTo('alpha', 'potato');
}