Packagecom.brightcove.fl.advertising.adSwf
Classpublic class AdSwf
InheritanceAdSwf Inheritance flash.display.MovieClip

Abstract base class for ad SWFs, which are used to display ads in the SWF format. See configureAd(), displayAd(), adComplete(), and AdSwfConfig.pauseVideoPlayer for the more important information on creating an ad SWF. See the ad SDK zip file for an example ad SWF which uses all of these APIs and provides a good starting point.

See also

configureAd()
displayAd()
AdSwfConfig.pauseVideoPlayer


Public Properties
 PropertyDefined By
  config : AdSwfConfig
[read-only] Configuration of the ad SWF.
AdSwf
  currentAdProperties : Object
[read-only] Override this function to provide a response for the player API call getCurrentAdProperties() on the AdvertisingModule.
AdSwf
  mediaDuration : Number
[read-only] When config.pauseVideoPlayer is true, override this function to tell the player the duration of an ad in seconds.
AdSwf
  mediaPosition : Number
[read-only] When config.pauseVideoPlayer is true, override this function to tell the player the current position of an ad in seconds.
AdSwf
Public Methods
 MethodDefined By
  
adComplete():void
Tells the player that the ad is done.
AdSwf
  
adPause():void
Tells the player that the ad has been paused.
AdSwf
  
adResume():void
Tells the player that the ad is resuming after being paused.
AdSwf
  
configureAd(pAdContext:AdSwfContext):void
Provides a way to set up the AdConfig parameters before displayAd() is called.
AdSwf
  
Tells the player that configureAd() is done.
AdSwf
  
dispatchAdEvent(event:Event):void
Dispatches the given event to the advertising module in the player API.
AdSwf
  
displayAd(pAdContext:AdSwfContext):void
Called when a new ad should be displayed.
AdSwf
Events
 Event Summary Defined By
  When config.pauseVideoPlayer is true, this event is dispatched when there's a request for media playback to pause.AdSwf
  When config.pauseVideoPlayer is true, this event is dispatched when there's a request for media playback to resume.AdSwf
  When config.pauseVideoPlayer is true, this event is dispatched when there's a request for media playback to change volume.AdSwf
Property Detail
configproperty
config:AdSwfConfig  [read-only]

Configuration of the ad SWF. These values should be set at the beginning of displayAd()


Implementation
    public function get config():AdSwfConfig

See also

currentAdPropertiesproperty 
currentAdProperties:Object  [read-only]

Override this function to provide a response for the player API call getCurrentAdProperties() on the AdvertisingModule.


Implementation
    public function get currentAdProperties():Object
mediaDurationproperty 
mediaDuration:Number  [read-only]

When config.pauseVideoPlayer is true, override this function to tell the player the duration of an ad in seconds. This is only relevant when pauseVideoPlayer is true. It is used to provide information to the player's video API. See getVideoDuration() in the VideoPlayerModule in the player API documentation. The default value for mediaDuration is 0 seconds.


Implementation
    public function get mediaDuration():Number
mediaPositionproperty 
mediaPosition:Number  [read-only]

When config.pauseVideoPlayer is true, override this function to tell the player the current position of an ad in seconds. It is used to provide information to the player's video API and to change the time remaining for the ad. See getVideoPosition() in the VideoPlayerModule in the player API documentation. The default value for mediaPosition is 0 seconds.


Implementation
    public function get mediaPosition():Number
Method Detail
adComplete()method
public function adComplete():void

Tells the player that the ad is done. This must be called when an ad is done playing. This dispatches the AD_COMPLETE event in the player API and allows more ads to play.

adPause()method 
public function adPause():void

Tells the player that the ad has been paused. This is usually only used when config.pauseVideoPlayer is true. This dispatches the AD_PAUSE event in the player API.

adResume()method 
public function adResume():void

Tells the player that the ad is resuming after being paused. This is usually only used when config.pauseVideoPlayer is true. This dispatches the AD_PAUSE event in the player API.

configureAd()method 
public function configureAd(pAdContext:AdSwfContext):void

Provides a way to set up the AdConfig parameters before displayAd() is called. Override this function if you need to set up AdSwfConfig for each ad request. configureAdComplete() must be called if this function is overriden.

Parameters

pAdContext:AdSwfContext

See also

configureAdComplete()method 
public function configureAdComplete():void

Tells the player that configureAd() is done. This function only needs to be called if configureAd() is overriden.

dispatchAdEvent()method 
public function dispatchAdEvent(event:Event):void

Dispatches the given event to the advertising module in the player API. This can be one of the built-in ad events found in AdEvent or a completely custom event. If you would like to dispatch one of the built-in ad events, you must use the AdEvent class found in the player SWC. This is most commonly used with AdSwfConfig.customStartStopEvents to allow for multiple ad start and stop events.

Parameters

event:Event

displayAd()method 
public function displayAd(pAdContext:AdSwfContext):void

Called when a new ad should be displayed. This function must be overriden by ad SWF implementations in order to display a SWF. External resources can be accessed or anything else that needs to be done in order to display the ad. adComplete() must be called when the ad is done.

Parameters

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

See also

Event Detail
pause Event
Event Object Type: com.brightcove.fl.advertising.adSwf.AdSwfMediaEvent
AdSwfMediaEvent.type property = com.brightcove.fl.advertising.adSwf.AdSwfMediaEvent.PAUSE

When config.pauseVideoPlayer is true, this event is dispatched when there's a request for media playback to pause. This can occur from a user click or a call in the player API to videoModule.pause(true).

Dispatched when there's a request for media playback to pause. This can occur from a user click or a call in the player API to videoModule.pause(true).
resume Event  
Event Object Type: com.brightcove.fl.advertising.adSwf.AdSwfMediaEvent
AdSwfMediaEvent.type property = com.brightcove.fl.advertising.adSwf.AdSwfMediaEvent.PLAY

When config.pauseVideoPlayer is true, this event is dispatched when there's a request for media playback to resume. This can occur from a user click or a call in the player API to videoModule.pause(false).

volumeChange Event  
Event Object Type: com.brightcove.fl.advertising.adSwf.AdSwfMediaEvent
AdSwfMediaEvent.type property = com.brightcove.fl.advertising.adSwf.AdSwfMediaEvent.VOLUME_CHANGE

When config.pauseVideoPlayer is true, this event is dispatched when there's a request for media playback to change volume. This can occur from a user click, a call in the player API to videoModule.setVolume(), or a call to videoModule.mute(). The new volume is set in volume. If the volume is muted, the volume will be 0.

Dispatched when there's a request for media playback to change volume. This can occur from a user click, a call in the player API to videoModule.setVolume(), or a call to videoModule.mute(). The new volume is set in volume. If the volume is muted, the volume will be 0.