Install eyeBuild (Creative Cloud)
Install eyeBuild (CS6 & older)

In order to publish an .SWF file which can be served without additional setup by eyereturn, you must implement eyereturn's eyeBuild class in your code. This will enable the file to communicate and interact with eyereturn's ad server. eyeBuild contains the basic functionality required for most ads, with methods to be called on basic user interactions such as click, close, and tracking events.

More complex ads which need to communicate and/or synchronize may require the eyeBuildPlus component, which shares all the functionality of eyeBuild and adds the necessary features to support more advanced ad units. See the eyeBuildPlus page for more information.

IMPORTANT! The eyeBuild component will add 2.5k to the final size of your published .SWF, so plan your file accordingly in order to meet file size specifications (found on the specifications page)

eyeBuild cannot be used for files that eyereturn is not serving (ie – most CPC placements)

Importing, Creating and Initializing eyeBuild

Before integrating any of eyereturn's eyeBuild functionality into the unit, you must first add the eyeBuild component to the FLA's library. Open your Components panel (Command-F7 on Mac, Ctrl-F7 on PC), locate the eyeBuild component in the eyereturn subfolder of your Components panel, and drag it into the Library panel. This will allow you to create and initialize the eyeBuild class in your document, following these steps:

for ActionScript 2: Add the following code to the first frame on the root timeline of the ad unit:

import com.eyeReturn.eyeBuild;

for ActionScript 3: Add the following code to the first frame on the root timeline of the ad unit:

import com.eyeReturn.eyeBuild;

-OR- for Actionscript 3: If the ad unit is constructed from external actionscript files, add the same code to the main document class, as in the following example:

package com.myMainClass {
	import flash.display.MovieClip;
	import flash.events.Event;
	import com.eyeReturn.eyeBuild;
	// import the eyeBuild class with the rest of the class' import statements
	public class myMainClass extends MovieClip {
		public function myMainClass():void {
			addEventListener(Event.ADDED_TO_STAGE, init);
			// create an Event Listener to handle the ADDED_TO_STAGE event
			// this is to ensure the document class has been added to the stage before initializing eyeBuild

		private function init(evt:Event):void {
			removeEventListener(Event.ADDED_TO_STAGE, init);
			// when the document class has been added to the stage, the listener is removed and the eyeBuild class is initialized

IMPORTANT! If your ad unit has code spread across multiple timeline frames, you must include the import statement (import com.eyeReturn.eyeBuild;) on each frame that contains a call to the eyeBuild class


To create the clickthrough for your ad unit, you need to call the doClick method of the eyeBuild class.


MULTIPLE CLICKTHROUGHS - If your ad has multiple clickthrough destinations, pass the ID number of the click as a parameter to the doClick call. The index numbers of the clickthroughs are 0-based. This means that the first clickthrough's ID is not 1, but 0. The above single-click examples call doClick with no ID number argument, which is equivalent to "eyeBuild.instance.doClick(0)", as 0 is the first (and default) clickthrough ID.

For example, the calls in an ad unit with 3 unique clickthroughs would look like:

// Main clickthrough
// OR

// Second clickthrough

// Third clickthrough

Be sure to make your contact at eyereturn aware of which URLs correspond to each clickthrough IDs, as they will be responsible for ensuring the URLs are called by the appropriate click events.

DYNAMIC CLICKTHROUGHS - Some clickthroughs need to be dynamically contructed, including variables from the ad unit as part the destination. In these cases, you may pass up to three strings as optional arguments to the doClick method.

For example, imagine that your ad unit features ten cars, each a different colour, and a mix of car models. All the cars are clickable to the same destination, but you need the colour of the car clicked included in the query string in order to affect which version appears on landing page.


To accomplish this, all of the clicked cars should make slightly different doClick calls. Specifically, the Black Sedan indicated by the above URL would be called as follows:

eyeBuild.instance.doClick(0, "Black", "Sedan", "None");

Provide your contact at eyereturn with instructions on how to construct the URL from the variables passed. In this case, they would need to know that the clickthrough needs to be constructed as follows:


Expanding Units

eyereturn hosts expanding units in two pieces; unexpanded and expanded. In order to communicate the opening and closing between the files, the doOpen() and doClose() calls are used. These calls require no arguments, simply apply them to the appropriate buttons in each file; the clickable area in the unexpanded file, and the close button in the expanded file.


Only click-to-expand banners require a doOpen call; the more common rollover-to-expand configuration does not require a doOpen call, or any code to detect the user's rollover All expanded files require a close button with the doClose call.

Event Tracking

If your ad unit requires tracking of content specific interactions (ie: a replay button, or the tracking of transport controls in a video unit), you must implement a doIAT() call when the event occurs. Each call requires a corresponding ID to be passed as an argument to the call.

The following table contains the eyeBuild calls for the most common tracking events. Implement these calls wherever applicable in your ad unit. For events not covered by this table, use the doCustomIAT() method as described in the next section.

Play eyeBuild.instance.doIAT(0);
Pause eyeBuild.instance.doIAT(1);
Stop eyeBuild.instance.doIAT(2);
Mute eyeBuild.instance.doIAT(3);
Unmute eyeBuild.instance.doIAT(4);
Video Start eyeBuild.instance.doIAT(5);
25% View eyeBuild.instance.doIAT(6);
50% View eyeBuild.instance.doIAT(7);
75% View eyeBuild.instance.doIAT(8);
100% View eyeBuild.instance.doIAT(9);
Replay eyeBuild.instance.doIAT(10);
Rollover to Expand eyeBuild.instance.doIAT(11);
Click to Expand eyeBuild.instance.doIAT(12);
Click to Play eyeBuild.instance.doIAT(13);
Click to Continue eyeBuild.instance.doIAT(14);
Next eyeBuild.instance.doIAT(15);
Previous eyeBuild.instance.doIAT(16);
Back eyeBuild.instance.doIAT(17);
Submit eyeBuild.instance.doIAT(18);

Custom Event Tracking

For unique events not covered in the previous section, the doCustomIAT() method allows you to create up to 100 your own tracking events, which will appear in reporting with the names of your choosing. First, create a list of the events you wish to track with the event name to be displayed in reporting, and a corresponding ID number, starting from 0 and incrementing for each new event. You will need to provide this list to your eyereturn contact upon delivery of the ad unit.

To implement these calls, you must call do doCustomIAT() method, which accepts two arguments; the ID number of the event, and a string to be returned as a trace in Flash' output window, for testing and debugging purposes. Please note that this string is only for testing/debugging purposes, and does not have any effect upon serving. The names and IDs must be provided to your eyereturn contact in order for eyereturn to enable the events in reporting. Use the traced messages to make sure that the the correct events are being called throughout your ad unit.

eyeBuild.instance.doCustomIAT(0, "Event A");
// Custom Event A
eyeBuild.instance.doCustomIAT(1, "Event B");
// Custom Event B
eyeBuild.instance.doCustomIAT(2, "Event C");
// Custom Event C

Feel free to use both standard doIAT() and custom doCustomIAT() tracking events in the same unit as required, but for continuity in reporting we prefer that the pre-defined doIAT() calls are used wherever applicable. For instance, we would advise against creating a custom event for "Send" where the "Submit" event doIAT(18) would suffice.

Importing External Resources

Many polite and rich media ad units need to load external resources into the main swf, such as videos, mp3s, XML documents, or additional images. In order to maintain a relative path to these files during development and testing and still publish a finished unit, eyeBuild provides a method called getPolite() which should be implemented every time you load external files into your unit.

During development, your unit will behave normally, loading your resources from the relative path you specify (preferably a single subdirectory consolidating all the external resources necessary for the unit). However, during trafficking, eyereturn is able to append the beginning of the absolute path to our resource server, where the resources will be hosted prior to trafficking. This eliminates the need to manually change file paths and republish the unit. The following code illustrates how this method should be implemented.

var holderClip:MovieClip = this.createEmptyMovieClip("holderClip", this.getNextHighestDepth());
// The above creates an empty movieClip to use as a holder, but you may target any clip on your timeline as needed

This differs from providing the path directly, ie: holderClip.loadMovie("politeResources/myResource.swf"). The getPolite() method will behave the same way locally, but provides the ability to modify the absolute location of resources during eyereturn's setup.