DoubleClick Studio AS3 API Reference

class com.google.ads.studio.vpaid.VpaidTimer

The VpaidTimer class is used to dispatch timer events even if there is no video object currently playing. Events are dispatched so that a custom UI can be updated, but the publisher video player is also updated with the total time left in the creative.

VpaidTimer is initialized with how long it will tick before it fires the COMPLETE event. It automatically figures out the total duration of the ad at runtime.
   import com.google.ads.studio.vpaid.VpaidTimer;
   var timer:VpaidTimer = new VpaidTimer(15); // Fire COMPLETE after 15s.
   
The Enabler dispatches several events (a full list is available in the events section). You can listen and handle them in the following manner:
   import com.google.ads.studio.vpaid.VpaidTimer;
   // All the event types are accessed through VpaidTimerEvent.
   import com.google.ads.studio.events.VpaidTimerEvent;
   import com.google.ads.studio.vpaid.VpaidTimer;
    
   // Initialize the VpaidTimer;
   var timer:VpaidTimer = new VpaidTimer(15); // Fire COMPLETE after 15s.
    
   var tickHandler:Function = function(event:VpaidTimerEvent):void {
     // This will output the amount of time left before the timer completes.
     trace(event.countdownTime);
     // This will output the amount of time left in the entire creative.
     trace(event.adRemainingTime);
   };
   enabler.addEventListener(VpaidTimerEvent.TICK, tickHandler);
   

Expand Events

Constructors

Expand
VpaidTimer(duration:Number=0)

Creates a new, non-reusable VpaidTimer that will report the remainging time to the enabler.

Instance Methods

Defined in com.google.ads.studio.vpaid:VpaidTimer

cancel() : void

Stops the timer and prevents any more events from firing. The publisher is no longer updated with the time left in the creative.

Back to top

  1. com.google.ads.studio
    1. AssetLoader
    2. ContextualDiscovery
    3. F2fEnabler
    4. FullScreenButton
    5. HtmlEnabler
    6. ProxyEnabler
    7. VpaidEnabler
  1. com.google.ads.studio.configurable
    1. Configurable
  1. com.google.ads.studio.display
    1. StudioLoader
  1. com.google.ads.studio.events
    1. StudioEvent
    2. StudioVideoEvent
  1. com.google.ads.studio.expanding
    1. Expanding
  1. com.google.ads.studio.localconnect
    1. LocalConnectWrapper
  1. com.google.ads.studio.video
    1. ConfigurableVideoPlayer
    2. EnhancedVideoController
    3. PlayPauseButton
    4. Playlist
    5. Scrubber
    6. SoundToggleButton
    7. VideoController
    8. VideoEntry
    9. VideoPlayer
    10. VideoPlayerAdvanced
  1. com.google.ads.studio.vpaid
    1. VpaidTimer