VPAID enables 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 that include VPAID protocols can play in both VAST and VPAID-enabled video players.
With VPAID, both linear and non-linear ads are supported, which include standard, expanding, overlay or mixed ads.
Standard banners with Adform Core components can function as VPAID ads. For advanced VPAID solutions, please see instructions below.
Instructions
How to "Close" 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 'clickTag':
- drag AdformCore component to stage
- draw clickTag button on stage
- give instanceName 'clickTag' to the button
- import com.adform.events.AdformSharedEvent
- add MouseEvent.CLICK eventListener to clickTag
- remove MouseEvent.CLICK eventListener on 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 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 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 custom 'skipAd' button:
- drag AdformCore component to stage
- draw skipAd button on stage
- give 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' ad:
- drag AdformCore component to 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 AdformCore component to 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 AdformCore component to stage
-
import
com.adform.events.AdformSharedEvent -
add
'pause'eventListener - pause 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 AdformCore component to stage
-
import
com.adform.events.AdformSharedEvent -
add
'resume'eventListener - resume 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 AdformCore component to stage
-
import
com.adform.events.AdformSharedEvent -
add
'volume'eventListener - update 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 ad flash vars to ad unit in MediaFile source:
plain: VPAIDWrapper.swf?url=adUnit.swf?param1=value1¶m2=value2 encoded: VPAIDWrapper.swf?url%3DadUnit.swf%3Fparam1%3Dvalue1%26param2%3Dvalue2
Note: all request params must be encoded.


