Packagese.videoplaza.kit.api.admodule
Classpublic class VpAdModule
InheritanceVpAdModule Inheritance flash.events.EventDispatcher

The VpAdModule acts as a wrapper for the admodules within the Ooyala Adplayer. VpAdModules replace the need for targets, as all support for targets are integrated into VpAdModules, providing a more powerful way of handling ads and their containers from within a video player bridge.

See also

se.videoplaza.kit.api.events.VpAdModuleEventType


Public Properties
 PropertyDefined by
  allAds : Array
[read-only]
VpAdModule
  currentAd : Ad
[read-only] Returns the Ad that is currently playing.
VpAdModule
  isInitialized : Boolean
[read-only] Returns whether or not the VpAdModule is initialized or not.
VpAdModule
  isLinear : Boolean
[read-only] Returns whether or not the VpAdModule is in a linear state or not.
VpAdModule
  module : Object
[read-only] To enable custom settings and actions, you can retrieve the actual AdModule wrapped by using this read-only property.
VpAdModule
  type : String
[read-only] Returns the type of VpAdModule as a String.
VpAdModule
  version : String
[read-only] Returns the version of the VpAdModule.
VpAdModule
  view : VpAdModuleView
[read-only] Returns the VpAdModuleView holding all graphics of the AdModule.
VpAdModule
  x : Number
Returns the x value of the VpAdModule
VpAdModule
  y : Number
Returns the y value of the VpAdModule
VpAdModule
Public Methods
 MethodDefined by
  
VpAdModule(adModuleToWrap:Object)
Creates an new VpAdModule.
VpAdModule
  
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
VpAdModule
  
dispatchEvent(event:Event):Boolean
VpAdModule
  
fadeIn(targetValue:Number = 1, duration:Number = .5, useSeconds:Boolean = true, easingFunction:Function = null):void
Fades in a VpAdModule.
VpAdModule
  
fadeOut(targetValue:Number = 0, duration:Number = .5, useSeconds:Boolean = true, easingFunction:Function = null):void
Fades out a VpAdModule.
VpAdModule
  
getControls():Object
Returns an IControls object, representing the controls of the VpAdModule.
VpAdModule
  
getVolume():Number
Gets the volume on the VpAdModule.
VpAdModule
  
hide():void
Hides the VpAdModule, alternatively all ads within the VpAdModule.
VpAdModule
  
motionTween(toValue:Number, property:String = "paddingBottom", duration:Number = .5, useSeconds:Boolean = true, easingFunction:Function = null):void
NOTE! Introduced in AdPlayer version 2.0.18, this functionality is resctricted to only support property "paddingBottom".
VpAdModule
  
pause():void
Should pause a VpAdModule.
VpAdModule
  
resetSize():void
Resets the size of the module to it's original values.
VpAdModule
  
resume():void
Should resume a VpAdModule that has been stopped from the state is was in when stopping.
VpAdModule
  
setPadding(pLeft:Number, pTop:Number, pRight:Number, pBottom:Number):void
Pads the VpAdModule from the outside and inwards, with passed values in pixels.
VpAdModule
  
show():void
Shows the VpAdModule, alternatively ads that should be visible within the VpAdModule.
VpAdModule
  
start():void
Starts the VpAdModule.
VpAdModule
  
stop():void
Stops the VpAdModule.
VpAdModule
  
update(updateType:String, data:Object = null):void
Updates the AdModule based on provided update type.
VpAdModule
Property detail
allAdsproperty
allAds:Array  [read-only]Implementation
    public function get allAds():Array
currentAdproperty 
currentAd:Ad  [read-only]

Returns the Ad that is currently playing. Listen to se.videoplaza.kit.api.events.VpAdModuleEventType.CURRENT_AD_UPDATED to get notified when this value has changed.

Implementation
    public function get currentAd():Ad

See also

isInitializedproperty 
isInitialized:Boolean  [read-only]

Returns whether or not the VpAdModule is initialized or not.

Implementation
    public function get isInitialized():Boolean
isLinearproperty 
isLinear:Boolean  [read-only]

Returns whether or not the VpAdModule is in a linear state or not.

Implementation
    public function get isLinear():Boolean
moduleproperty 
module:Object  [read-only]

To enable custom settings and actions, you can retrieve the actual AdModule wrapped by using this read-only property.

Implementation
    public function get module():Object
typeproperty 
type:String  [read-only]

Returns the type of VpAdModule as a String.

Implementation
    public function get type():String

See also

versionproperty 
version:String  [read-only]

Returns the version of the VpAdModule.

Implementation
    public function get version():String
viewproperty 
view:VpAdModuleView  [read-only]

Returns the VpAdModuleView holding all graphics of the AdModule.

Implementation
    public function get view():VpAdModuleView
xproperty 
x:Number  [read-write]

Returns the x value of the VpAdModule

Implementation
    public function get x():Number
    public function set x(value:Number):void
yproperty 
y:Number  [read-write]

Returns the y value of the VpAdModule

Implementation
    public function get y():Number
    public function set y(value:Number):void
Constructor detail
VpAdModule()constructor
public function VpAdModule(adModuleToWrap:Object)

Creates an new VpAdModule. Since this is a wrapper, you need to pass the admodule to be wrapped into the constructor.

Parameters
adModuleToWrap:Object

See also


Example
The following example illustrates the scenario where you want to know when a certain module has been created, so that you can create an instance of VpAdModule and start listening to events fired from it. As soon as you've created the VpAdPlayerWrapper, you can listen for the AD_MODULE_CREATED event.
  private function initAdPlayer(): {
   ...
   adPlayer.addEventListener(VpEventType.AD_MODULE_CREATED,onAdModuleCreated);
   ...
  }
  
  private function onAdModuleCreated(ev:Event):void {
   if(Object(ev).getData() == VpAdModuleName.SKIN_ADMODULE) {
    var adModule:VpAdModule = new VpAdModule(adPlayer.getAdModule(VpAdModuleName.SKIN_ADMODULE));
    adModule.addEventListener(VpAdModuleEventType.SHOW,onSkinModuleShow);
   }
  }
  
  private function onSkinModuleShow(ev:Event):void {
   VpDebug.log("Skin dispatched SHOW in bridge",dColor,VpDebug.BRIDGE);
  }
   

Method detail
addEventListener()method
public override function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void

Parameters
type:String
 
listener:Function
 
useCapture:Boolean (default = false)
 
priority:int (default = 0)
 
useWeakReference:Boolean (default = false)
dispatchEvent()method 
public override function dispatchEvent(event:Event):Boolean

Parameters
event:Event

Returns
Boolean
fadeIn()method 
public function fadeIn(targetValue:Number = 1, duration:Number = .5, useSeconds:Boolean = true, easingFunction:Function = null):void

Fades in a VpAdModule. Most often this means fading the controls of the VpAdModule.

Parameters
targetValue:Number (default = 1) — Alpha value to fade to.
 
duration:Number (default = .5) — Time in seconds or fps to fade.
 
useSeconds:Boolean (default = true) — Defaults to true.
 
easingFunction:Function (default = null) — Pass your easing function (optional)
fadeOut()method 
public function fadeOut(targetValue:Number = 0, duration:Number = .5, useSeconds:Boolean = true, easingFunction:Function = null):void

Fades out a VpAdModule. Most often this means fading the controls of the VpAdModule.

Parameters
targetValue:Number (default = 0) — Alpha value to fade to.
 
duration:Number (default = .5) — Time in seconds or fps to fade.
 
useSeconds:Boolean (default = true) — Defaults to true.
 
easingFunction:Function (default = null) — Pass your easing function (optional)
getControls()method 
public function getControls():Object

Returns an IControls object, representing the controls of the VpAdModule.

Returns
Object — IControls object.

See also

IControls
getVolume()method 
public function getVolume():Number

Gets the volume on the VpAdModule. Setting of volume should be handled via the update method.

Returns
Number
hide()method 
public function hide():void

Hides the VpAdModule, alternatively all ads within the VpAdModule.

motionTween()method 
public function motionTween(toValue:Number, property:String = "paddingBottom", duration:Number = .5, useSeconds:Boolean = true, easingFunction:Function = null):void

NOTE! Introduced in AdPlayer version 2.0.18, this functionality is resctricted to only support property "paddingBottom". Further support will be added in future versions. Tween effect. This is provided for functionality that requires the possibility of tweening an object on the Y-axis.

Parameters
toValue:Number — Starting value
 
property:String (default = "paddingBottom") — End value
 
duration:Number (default = .5) — Duration of tween
 
useSeconds:Boolean (default = true) — Whether to use seconds or not
 
easingFunction:Function (default = null) — Optional easing function
pause()method 
public function pause():void

Should pause a VpAdModule. It should differ from stop in that it should return the state is was in when being resumed.

resetSize()method 
public function resetSize():void

Resets the size of the module to it's original values.

resume()method 
public function resume():void

Should resume a VpAdModule that has been stopped from the state is was in when stopping.

setPadding()method 
public function setPadding(pLeft:Number, pTop:Number, pRight:Number, pBottom:Number):void

Pads the VpAdModule from the outside and inwards, with passed values in pixels. NOTE: This method is not defined in the interface IAdModule, which means that some AdModules may not support this. In such a case, an error is thrown.

Parameters
pLeft:Number — Amount to pad from left edge.
 
pTop:Number — Amount to pad from top edge.
 
pRight:Number — Amount to pad from right edge.
 
pBottom:Number — Amount to pad from bottom edge.
show()method 
public function show():void

Shows the VpAdModule, alternatively ads that should be visible within the VpAdModule.

start()method 
public function start():void

Starts the VpAdModule. Typically this means start running ads within the VpAdModule.

stop()method 
public function stop():void

Stops the VpAdModule. Typically this affects VpAdModules running ads sequentially, when the stop call will halt the sequence.

update()method 
public function update(updateType:String, data:Object = null):void

Updates the AdModule based on provided update type. Available update types are found in the VpAdModuleUpdateType class.

Parameters
updateType:String — String type of update
 
data:Object (default = null) — Optional data object. For "size", a Rectangle should be passed. For "volume" a number (0-1) should be passed.

See also