mediamind SyncAds

本文介绍如何利用SyncAds类在广告层级上实现消息传递,具体包括设置同步级别、查找连接以及触发同步操作等关键步骤。

1.可以用在两个层次上:campaign level  and the ad level

2

Ad 1 - The ad that sends the message

Ad 2 - The ad that receives the message

//import the SyncAds class

import eyeblaster.utilities.syncAds.SyncAds;

//create an instance of the SyncAds class

var syncAd_mc:SyncAds = new SyncAds();

//set the synchronization level.

//Possible values:"ad", "campaign"

//Note: This function is optional, but if used,

//should be the first function called.

syncAd_mc.level = "campaign";

//look for a connection name called "sidePanel" for

//5 seconds

syncAd_mc.findConnection("sidePanel",5);

//an event that will be called when the

//connection that was being looked for was found.

syncAd_mc.onConnectionFound = doSyncAction;

//an event that will be called in case the

//connection that was being looked for was not

//found after the 5 seconds of searching.

syncAd_mc.onConnectionNotFound = doConnectionNotFound;

//the function that was designated to fire after the //onConnectionFound event is triggered.This

//function will usually contain the calls that start

//the synchronization between the ads or assets.

function doSyncAction(connectionName:String)

{

//this function is used to send the event //to a specific resource.

syncAd_mc.callConnection(connectionName, "doSidePanelAction");

movingClip.play();

}

//the function that was designated to fire after the //onConnectionNotFound event is triggered.

function doConnectionNotFound(connectionName:String)

{

trace("connectionName: " + connectionName + " was not found");

}

 

//import the SyncAds class

import eyeblaster.utilities.syncAds.SyncAds;

//create an instance of the SyncAds class

var syncAd_mc:SyncAds = new SyncAds();

//set the synchronization level.

//Possible values:"ad", "campaign"

//Note: This function is optional, but if used, should be the //first function called.

syncAd_mc.level= "campaign";

//open a connection named “side”panel”

syncAd_mc.openConnection("sidePanel");

//Event function ("doSidePanelAction") that is

//called by the other Ad. In this example it is called by the //syncAd_mc.callConnection("sidePanel",

//"doSidePanelAction"); function in the other asset

function doSidePanelAction()

{

// plays animation in panel.

movingPanelClip.play();

}

 

 

 

转载于:https://www.cnblogs.com/1000pen/archive/2012/11/02/2751655.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值