VPAID enables the cross-platform support for rich in-stream video ads. A valid VPAID object can be used in conjunction with the VAST and is highly recommended as VAST ads, which include VPAID protocols, can play in both VAST and VPAID-enabled video players.

With VPAID, both linear and non-linear ads are supported, including standard, expanding, overlay, or mixed ads.

Standard banners with the Adform Core components can function as VPAID ads. For advanced VPAID solutions, please see instructions below.

Note: currently, only flash VPAID ads are supported. 

Instructions

How to "Close" an ad:

  • add AdformCloseButton to the banner;
  • drag AdformCore component to the stage and dispatch 'close' AdformSharedEvent from your ad.
import com.adform.events.AdformSharedEvent;
root.loaderInfo.sharedEvents.dispatchEvent(new AdformSharedEvent('close'));

How to add a 'clickTag':

  • drag the AdformCore component to the stage;
  • draw a clickTag button on the stage;
  • give an instanceName 'clickTag' to the button;
  • import com.adform.events.AdformSharedEvent;
  • add MouseEvent.CLICK eventListener to the clickTag;
  • remove MouseEvent.CLICK eventListener on the clickTag click;
  • dispatch 'click' AdformSharedEvent.
import com.adform.events.AdformSharedEvent;
clickTag.addEventListener(MouseEvent.CLICK, onClickTagClick);

function onClickTagClick(e : MouseEvent) : void {
  clickTag.removeEventListener(MouseEvent.CLICK, onClickTagClick);
  root.loaderInfo.sharedEvents.dispatchEvent(new AdformSharedEvent('click'));
}

How to set 'expand':

  • drag the AdformCore component to stage;
  • dispatch 'expand' AdformSharedEvent from your ad.
import com.adform.events.AdformSharedEvent;

root.loaderInfo.sharedEvents.dispatchEvent(new AdformSharedEvent('expand'));

How to set 'collapse'

  • drag the AdformCore component to stage;
  • dispatch 'collapse' AdformSharedEvent from your ad.
import com.adform.events.AdformSharedEvent;
root.loaderInfo.sharedEvents.dispatchEvent(new AdformSharedEvent('collapse'));

How to implement a custom 'skipAd' button:

  • drag the AdformCore component to the stage;
  • draw skipAd button on the stage;
  • give an instanceName 'skipAdBtn' to the button;
  • import com.adform.events.AdformSharedEvent;
  • add MouseEvent.CLICK eventListener to skipAdBtn;
  • remove MouseEvent.CLICK eventListener on skipAdBtn click;
  • dispatch 'skip' AdformSharedEvent.
import com.adform.events.AdformSharedEvent;
skipAdButton.addEventListener(MouseEvent.CLICK, onSkipAdBtnClick);

function onSkipAdBtnClick(e : MouseEvent) : void {
    clickTag.removeEventListener(MouseEvent.CLICK, onSkipAdBtnClick);
    root.loaderInfo.sharedEvents.dispatchEvent(new AdformSharedEvent('skip'));
}

How to 'resize' an ad:

  • drag the AdformCore component to the stage;
  • import com.adform.events.AdformSharedEvent;
  • add 'resize' eventListener;
  • reposition ad elements according to data object from event.
root.loaderInfo.sharedEvents.addEventListener('resize', onAdResize);

function onAdResize(e : AdformSharedEvent) : void {
  // var data : Object = e.data;
  // data.playerWidth -> player width in pixels
  // data.playerHeight -> player width in pixels
  // data.viewMode -> "normal"/"thumbnail"/"fullscreen"
  // TODO : reposition ad elements according to data
}

How to update ad according to player 'start'

  • place your starting code in the firstFrame;

or

  • drag the AdformCore component to the stage;
  • import com.adform.events.AdformSharedEvent;
  • add 'start' eventListener;
  • update ad elements according to data object from event.

The code is as follows:

import com.adform.events.AdformSharedEvent;
import com.adform.events.AdformSharedEvent;
root.loaderInfo.sharedEvents.addEventListener('start', onAdStart);

function onAdStart(e : AdformSharedEvent) : void {
  // var data : Object = e.data;
  // data.playerWidth -> player width in pixels
  // data.playerHeight -> player width in pixels
  // data.viewMode -> "normal"/"thumbnail"/"fullscreen"
  // TODO : update ad elements according to data
}

How to 'pause' ad:

  • drag the AdformCore component to the stage;
  • import com.adform.events.AdformSharedEvent;
  • add 'pause' eventListener;
  • pause the ad.

The code is as follows:

import com.adform.events.AdformSharedEvent;
root.loaderInfo.sharedEvents.addEventListener('pause', onAdPause);

function onAdPause(e : AdformSharedEvent) : void {
  // TODO : pause ad
}

How to 'resume' ad:

  • drag the AdformCore component to the stage;
  • import com.adform.events.AdformSharedEvent;
  • add 'resume' eventListener;
  • resume the ad.
import com.adform.events.AdformSharedEvent;
root.loaderInfo.sharedEvents.addEventListener('pause', onAdPause);

function onAdPause(e : AdformSharedEvent) : void {
  // TODO : pause ad
}

How to 'update' volume:

  • drag the AdformCore component to the stage;
  • import com.adform.events.AdformSharedEvent;
  • add 'volume' eventListener;
  • update the ad volume.

The code is as follows:

import com.adform.events.AdformSharedEvent;
  root.loaderInfo.sharedEvents.addEventListener('volume', onAdVolumeChange);

  function onAdVolumeChange(e : AdformSharedEvent) : void {
    // var data : Object = e.data;
    // data.volume
    // TODO : change volume
  }

VAST setup:

Both Linear and Non-linear ads must have these AdParameters set:

linear → true/false

clickTAG → your clickTAG URL

the code is as follows:

<AdParameters>
  <linear>true</linear>
  <clickTAG><![CDATA[http://www.adform.com/site/]]></clickTAG>
</AdParameters>

Ad Unit flash vars in VAST

There is a possibility to add flash vars to the ad unit in MediaFile source:

plain:   VPAIDWrapper.swf?url=adUnit.swf?param1=value1&param2=value2
encoded: VPAIDWrapper.swf?url%3DadUnit.swf%3Fparam1%3Dvalue1%26param2%3Dvalue2

Note: all request parameters must be encoded.