Packagecom.brightcove.fl.advertising.translation
Classpublic class AdTranslation
InheritanceAdTranslation Inheritance flash.display.MovieClip

Abstract base class for ad translators, which are used to request and parse ad requests for ad servers for the player. See ExampleTranslator for an example of an ad translation implementation.



Public Properties
 PropertyDefined By
  concurrentFetchAd : Boolean = true
When multiple ads are requested in the same insertion point, this decides whether all of the fetchAd() calls happen at once (concurrently) or whether each fetchAd() call only happens when the previous ad is done playing.
AdTranslation
Protected Properties
 PropertyDefined By
  adSwf : AdSwf
[write-only] Set the AdSwf that should be used.
AdTranslation
Public Methods
 MethodDefined By
  
adSwfLoaded(adSwf:AdSwf):void
Called when loadAdSwf() has loaded the AdSwf.
AdTranslation
  
encodeAdXML(pErrorID:int, pTranslatorDesc:String, pMalformedXML:String):XML
Encodes malformed XML and returns the result as an externalAd.
AdTranslation
  
fetchAd(pAdContext:AdContext):void
Called when a new ad should be requested.
AdTranslation
Protected Methods
 MethodDefined By
  
loadAdSwf(pUrl:String):void
Load a AdSwf from a URL.
AdTranslation
  
setAdXML(pXML:XML):void
Sets the XML which is used by the player to try to play an ad.
AdTranslation
  
setNoAd():void
Tells the player that there is no ad for this ad request.
AdTranslation
  
useAdSwf():void
Tells the player to use the ad translator's AdSwf to play an ad.
AdTranslation
Property Detail
adSwfproperty
adSwf:AdSwf  [write-only]

Set the AdSwf that should be used. Either this function or loadAdSwf() must be called if useAdSwf() is going to be called.


Implementation
    protected function set adSwf(value:AdSwf):void
concurrentFetchAdproperty 
public var concurrentFetchAd:Boolean = true

When multiple ads are requested in the same insertion point, this decides whether all of the fetchAd() calls happen at once (concurrently) or whether each fetchAd() call only happens when the previous ad is done playing.

Method Detail
adSwfLoaded()method
public function adSwfLoaded(adSwf:AdSwf):void

Called when loadAdSwf() has loaded the AdSwf. Override this method to get a reference to the loaded AdSwf. The adSwf will be null if there was a problem in loading it.

Parameters

adSwf:AdSwf

encodeAdXML()method 
public function encodeAdXML(pErrorID:int, pTranslatorDesc:String, pMalformedXML:String):XML

Encodes malformed XML and returns the result as an externalAd. For example: This is useful when an ad network returns malformed XML from an ad request and this XML needs to be played as an external ad.

Parameters

pErrorID:int — error id after loading the ad XML. In this case, encondeAdXML checks for error id 1090 before playing the ad as external ad.
 
pTranslatorDesc:String — a label or description to identify your translator in the BC viewer debugger. encodeAdXML traces out debug statements when the ad XML cannot be played as external ad.
 
pMalformedXML:String — XML returned from ad server.

Returns
XML
fetchAd()method 
public function fetchAd(pAdContext:AdContext):void

Called when a new ad should be requested. This function must be overriden by ad translation implementations in order to request an ad.

Parameters

pAdContext:AdContext — The current context of the player to be used for the ad request.

loadAdSwf()method 
protected function loadAdSwf(pUrl:String):void

Load a AdSwf from a URL. This should be called in the constructor of an implementaion to load an ad SWF from a URL. You can get a handle on the ad SWF from adSwfLoaded() and tell the player to use the ad SWF in an ad response in useAdSwf(). If this method is call in a constructor, it is guaranteed to be finished before fetchAd() is ever called.

Parameters

pUrl:String

setAdXML()method 
protected function setAdXML(pXML:XML):void

Sets the XML which is used by the player to try to play an ad. This method (or setNoAd() or useAdSwf()) must be called by ad translation implementations whenever fetchAd() is done processing an ad.

Parameters

pXML:XML — XML returned from ad server.

setNoAd()method 
protected function setNoAd():void

Tells the player that there is no ad for this ad request. This is the same as passing in null to setAdXML(). This method (or setAdXML() or useAdSwf()) must be called by ad translation implementations whenever fetchAd() is done processing an ad.

useAdSwf()method 
protected function useAdSwf():void

Tells the player to use the ad translator's AdSwf to play an ad. The ad translator's ad SWF can be set through the adSwf setter or loadAdSwf(). This method (or setNoAd() or setAdXML()) must be called by ad translation implementations whenever fetchAd() is done processing an ad.