MPU banners

1. Banner summary

ID Number: 19H036.
Description: several inter-related flash-movies.
Type of a code: ajax.
Examples: MPU.
Third party tracking: flash banner preparation for further AdRiver pixel insertion.
Specification: MPU banner consist of some flash movies. One of the movie is master which control the other movies (panels). Master hasn’t display a banner. He is downloaded first and waiting for downloading of panels. Panels interact through the master relative to which they are positioned. When panels have been downloaded, the initDone function is called. This function starts the banner’s scenario. Up to the point, master and panels are stopped. In the first frame of a panel there is initialization and sending message to the master that panel has loaded and is ready to take commands. After that panel is stopped. Panels interact with each other only through master, using sendSync command. Master’s «startScene» function tracks commands from panels and acts properly.
Alternative names: FlyScreen, OverLay.

2. Banner preparation (ActionScript2)

2.1. Master

Download the sources for flash movies. Save in an one folder master1.as file and sources of a master.

First frame of master should contain the following ActionScript:


#include "master1.as" 

function startScene(panel, sync) { 
	switch (sync) { 
	  case "showPanel1" : 
		showPanel("panel1"); 
		sendToPanel("panel1","go","start"); 
		        break; 
	  case "showPanel2" : 
		showPanel("panel2"); 
		sendToPanel("panel2","go","start"); 
		        break; 

	  case "hidePanel1" : 
		hidePanel("panel1"); 
		       break; 
	  case "hidePanel2" : 
		hidePanel("panel2"); 
		       break; 
		} 
	} 

function initDone() { 
	  sendEvent(0); 
	  showPanel("panel1"); 
	  sendToPanel("panel1","go","start"); 
	} 

registerMaster(initDone,startScene,["panel1", "panel2"]); 
stop();

Description:

  • function startScene(panel, sync) — is an execution manager. He carries out the scenario of the panels interaction.
  • function initDone() — automatically initializes the flash-movie when panels are downloaded. These functions use the following commands:
    • sync — is the synchronization mark. Using it panels report to master. After sending the sync command panel can stop or continue running commands.
    • showPanel — show the panel.
    • hidePanel — hide the panel.
    • sendToPanel — send to panel command go to the certain mark.
    • sendEvent — send an event to AdRiver.
  • registerMaster(initDone, startScene, [«panel1», «panel2»]) — registers master and waiting for the confirmation of the panels’ complete download. Arguments:
    • initDone function.
    • startScene function.
    • list of the panels with ids [«panel1», «panel2»].

To create your own scenario of panels interaction use showPanel, hidePanel, sendToPanel commands.

For other events in the banner («show video» event, «open new tab» event) use events with numbers 0–9 (total 10 events is available). Zero event is reserved and reports that download is complete. It is critical to register event 0 before the 1–9 events. It is OK to register it in initDone function. Use sendEvent(eventId) command to register events. If events are not use, it is OK not to use sendEvent(0) command in initDone function.

2.2. Panels

Save in an one folder panels1.as file and sources of all panels. When panels are downloaded for the first time, layers are open (visible), that is why the first frame of the panel is often empty & transparent.

First frame of the first panel should contain the following ActionScript:


#include "panels1.as"

registerPanel("panel1");	// to register the panel
stop();				// stop and waiting for following actions 

panel1 is panel name.

Use the following ActionScript to report to master about moving to the next stage:


sendSync("showPanel2"); // go to the second panel 
stop();

To determine how many times panels can be displayed the first frame of the master should contain the following ActionScript (changes are highlighted in red):


#include "master1.as"

_root.deb.text = "";

 var k=3; // amount of impressions  var i=0;

function debug(txt){
    trace(txt);
    _root.deb.text += txt + "n";     
}
function startScene(panel, sync){
     debug ("received: " + sync + " from: " + panel);
     switch (sync){
    case "showPanel2": 		// showPanel2 mark

	 if (i<k) { 	     showPanel("panel2"); //to show panel2 	     sendToPanel("panel2","go","start"); // panel go to start mark 	 } 	 i++;
	      break;
        case "playPanel1": 
             sendToPanel("panel1", "go", "continue");
             break;
        case "hidePanel2":		// hidePanel2 mark
             hidePanel("panel2");	//to hide panel2
	     break;
	}	
}
function initDone(){
       debug ("initDone");
	sendEvent(0);		// report AdRiver that download is complete
	hidePanel("panel2");	//to hide panel2
	showPanel("panel1");	//to show panel1
	sendToPanel("panel1","go","start");	// panel1 go to start mark. 
}
registerMaster(initDone, startScene, ["panel1", "panel2"]);
stop(); //stop and wait for complete download of the panels

For click a flash-movie should contain a button element with the following ActionScript:


on (release) {
 makeClick()
}

This function can be used with parameter — alternative URL: makeClick(«http://www.example.com»).

To download in flash-movie additional parts (downloaded with banner), you should add name of an additional part to a _root.ar_comppath.
Example:


 _root.ar_comppath + 'flash_name.swf'

3. Banner preparation (ActionScript3)

3.1. Master

Download the sources. Save in an one folder sources of all flash-movies and «adriver» folder (contains masterAS3.as and panelsAS3.as libs).

First frame of master should contain the following ActionScript:


import adriver.masterAS3;

var my_adriver:masterAS3 = new masterAS3(this);
my_adriver.startScene = function(panel, sync){
	with(this){
		switch(sync){
			case "showPanel1":
				showPanel("panel1");
				sendToPanel("panel1", "go", "start");
				break;
			case "showPanel2":
				showPanel("panel2");
				sendToPanel("panel2", "go", "start");
				break;
			case "hidePanel1":
				hidePanel("panel1");
				break;
			case "hidePanel2":
				hidePanel("panel2");
				break;
		}
	}
}
my_adriver.initDone = function(){
	with(this){
		sendEvent(0);

		showPanel("panel1");
		sendToPanel("panel1", "go", "start");
	}
}

Description:

  • function startScene(panel, sync) — is an execution manager. He carries out the scenario of the panels interaction.
  • function initDone() — automatically initializes the flash-movie when panels are downloaded.
    • sync — is the synchronization mark. Using it panels report to master. After sending the sync command panel can stop or continue running commands.
    • showPanel — show the panel.
    • hidePanel — hide the panel.
    • sendToPanel — send to panel command go to the certain mark.
    • sendEvent — send an event to AdRiver.
  • These functions use the following commands:

To create your own scenario of panels interaction use showPanel, hidePanel, sendToPanel commands.

For other events in the banner («show video» event, «open new tab» event) use events with numbers 0–9 (total 10 events is available). Zero event is reserved and reports that download is complete. It is critical to register event 0 before the 1–9 events. It is OK to register it in initDone function. Use sendEvent(eventId) command to register events. If events are not use, it is OK not to use sendEvent(0) command in initDone function.

3.2. Panels

When panels are downloaded for the first time, layers are open (visible), that is why the first frame of the panel is often empty & transparent.

Some frame of the panel should contain the following ActionScript:


import adriver.panelsAS3;
var my_adriver:panelsAS3 = new panelsAS3('panel1', this);
stop();

panel1 — is panel name.

In panels commands are called as follows:


my_adriver.sendSync("showPanel2");

For clicks through create a button element in some frame. Attach the following ActionScript to this button:


function cl(event:MouseEvent):void {
	 my_adriver.makeClick();
}
_click.addEventListener(MouseEvent.CLICK, cl);

To download in flash-movie additional parts (downloaded with banner), you should add name of an additional part to a _root.ar_comppath.

Example:


my_adriver.ar_comppath + 'flash_name.swf'

To call event use the following ActionScript:


my_adriver.sendEvent(2);

4. JavaScript preparation

Open a script.js file with text editor. You may change only an editable block. Example:


var ar_gif		= '0.gif';
var ar_gif_href	= '';
var ar_pix		= '';
  • ar_gif — an image name, may contain ‘http://’, in this case will be loaded from location.
  • ar_gif_href — alternative click through image if need.
  • ar_pix — external counter for banner if need.

Other variables that can be edited (highlighted red):


var m_html = a.makeFlash('master.swf'),
	 p1_html = a.makeFlash('panel1.swf', {wmode: 'transparent'}),
	 p2_html = a.makeFlash('panel2.swf');
			
a.MPU.addPanel("master", {width:"240px", height:"400px"}, m_html);
a.MPU.addPanel("panel1", {width:"800px", height:"400px", position:"absolute", left:"0px", top:"0px", zIndex:2}, p1_html);
a.MPU.addPanel("panel2", {width:"240px", height:"400px", position:"absolute", left:"0px", top:"0px", zIndex:1}, p2_html);
  • master.swf — master name, panel1.swf — first panel name, panel2.swf — second panel name.
  • width, height — width and height of master and panels.
  • left, top — displacement of master and panels.

If need, edit the other parameters: position, zIndex.

5. Requirements

Names of the files can consist of numbers, latin letters or underscore symbols only and can’t contain any russian letters, space symbols, quotes or other special symbols. Size of the flash banner and the image should be the same.

6. Functional test

For local test on a web-server download the test files.

  1. Following files should be saved at the same folder:
    • adriver.core2.js;
    • merle-reply.js;
    • index.html.
  2. Add prepared flash movies and script.js file at the folder:
    • master.swf;
    • panel1.swf;
    • panel2.swf;
    • script.js.
  3. Open the index.html file at web-browser. Banner should be shown correctly according to the planned actions.
  4. Click through the banner, if the site will be loaded than banner was wrong prepared.
  5. Note, that Flash Player security system may display warning message therefore you should allow flash movie playback.

NOTE! In complex interrelated banners neither AdRiver nor advertising agency has little possibility to check and/or correct the banner scenario. A designer that created the banner is responsible for that.

7. The limit of the file size for banners in AdRiver

  • gif, jpeg, png-files (img width x height banners on AdRiver) — 600К;
  • swf-files (flash width x height banners on AdRiver) — 600K;
  • other file types — 600K;
  • for multicomponent banners the limits are checked for each one component.

To download in the banner files with extra-limit size you can use the box Расположение на стороннем сервере, in which you should insert the pathname to an external server.

For the banners that can’t be loaded from an external server it is possible to increase the limits of the file size. It comes to agreement with sales and support departments.

Last modified on 29.03.2016