DoubleClick Studio AS3 API Reference

class com.google.ads.studio.AbstractEnabler

AbstractEnabler serves as the base class that HTML and F2F Enablers implement. This class must be present and initialized in the main (parent) asset of every DoubleClick Rich Media creative. It is the bridge between the creative and the ad delivery platform, and takes care of setting up environment variables, making tracking requests, and dispatching important events based on events taking place in the external environment. The Enabler is a non-DisplayObject class. Because of this, a reference to the stage must be passed into the class during initialization. This enables the Enabler to pick up and process the flashVars. Note that Multiple Event Tracking triplet is referred to as MET.

Constants

NameValueDescription
BANDWIDTH_CABLE3

A possible value returned from getUserBandwidth which represents a cable bandwidth.

BANDWIDTH_DIALUP1

A possible value returned from getUserBandwidth which represents a dialup bandwidth.

BANDWIDTH_DSL2

A possible value returned from getUserBandwidth which represents a DSL bandwidth.

BANDWIDTH_T14

A possible value returned from getUserBandwidth which represents a T1 or greater bandwidth.

BANDWIDTH_UNKNOWN0

A possible value returned from getUserBandwidth which represents an unknown or undetectable bandwidth.

VIDEO_IDENTIFIER_DUMMY_PREFIXconfigurable_vri_

Prefix that configurable video player uses for unique dummy reporting identifiers. A random ID will be appended in practice.

Expand Events

Instance Methods

Defined in com.google.ads.studio:AbstractEnabler

close() : void

Closes floating and Pop-up creative types. If it is an expanding creative, close acts as a proxy to collapse.

     var closeClickHandler:Function = function(event:MouseEvent):void {
       enabler.close();
     };
     closeButton.addEventListener(MouseEvent.CLICK, closeClickHandler);
     

Expand
closeCompanion(assetName:String=null) : void

Closes the companion asset for floating, reminder and Pop-up creative types.

     var closeClickHandler:Function = function(event:MouseEvent):void {
       enabler.closeCompanion();
     };
     closeButton.addEventListener(MouseEvent.CLICK, closeClickHandler);
     

collapse() : void

Clips the container of the Flash asset from the expanded dimensions to the collapsed dimensions. This function is only applicable for expandable ad formats.

     var collapseClickHandler:Function = function(event:MouseEvent):void {
       enabler.collapse();
     };
     collapseButton.addEventListener(MouseEvent.CLICK, collapseClickHandler);
     

Expand
counter(eventId:String, isCumulative:Boolean=false) : void

Tracks a counter event.

     var closeClickHandler:Function = function(event:MouseEvent):void {
       enabler.counter("Close Button Counter");
       enabler.close();
     };
     collapseButton.addEventListener(MouseEvent.CLICK, closeClickHandler);
     

Expand
displayCompanion(assetName:String=null) : void

Displays the companion asset.

     var showClickHandler:Function = function(event:MouseEvent):void {
       enabler.displayCompanion();
     };
     showButton.addEventListener(MouseEvent.CLICK, showClickHandler);
     

Expand
exit(exitId:String, url:String=null) : void

Opens a new window with the URL as identified by the given exit ID.

     var exitClickHandler:Function = function(event:MouseEvent):void {
       enabler.exit("Background Exit");
     };
     customExitButton.addEventListener(MouseEvent.CLICK, exitClickHandler);
     

exitFullScreen() : void

Exits Flash's native fullscreen mode.

     var closeFsClickHandler:Function = function(event:MouseEvent):void {
       enabler.exitFullScreen();
     };
     closeFsButton.addEventListener(MouseEvent.CLICK, closeFsClickHandler);
     

Expand
exitQueryString(id:String, queryString:String) : void

Opens a new window with the URL as identified by the given exit id. The queryString is appended to the URL.

     var exitClickHandler:Function = function(event:MouseEvent):void {
       enabler.exitQueryString("Background Exit", "id=doubleclick");
     };
     customExitButton.addEventListener(MouseEvent.CLICK, exitClickHandler);
     

Expand
expand(disableTracking:Boolean=false) : void

Unclips the container of the Flash asset from the collapsed dimensions to the expanded dimensions. This function is only applicable for expandable ad formats.

     var expandClickHandler:Function = function(event:MouseEvent):void {
       enabler.expand();
     };
     expandButton.addEventListener(MouseEvent.CLICK, expandClickHandler);
     

finishedLoad() : void

This method decrements the count of assets that are currently loading. It should be called when you are finished loading an asset. See Enabler.waitForLoad() for an example.

Expand
getCustomParameter(variableName:String)

Retrieves a custom parameter.

     var stringParam:String = enabler.getCustomParameter("stringParam");
     

getDartAdId() : int

Gets the DART ad ID.

     enabler.exitQueryString("Background Exit", enabler.getDartAdId());
     

getDartCreativeId() : int

Gets the DART creative ID.

     enabler.exitQueryString("Background Exit", enabler.getDartCreativeId());
     

getDartPageId() : int

Gets the DART page ID.

     enabler.exitQueryString("Background Exit", enabler.getDartPageId());
     

getDartRenderingId() : int

Gets the DART rendering ID.

     enabler.exitQueryString(
         "Background Exit",
         enabler.getDartRenderingId());
     

getDartSiteId() : int

Gets the DART site ID.

     enabler.exitQueryString("Background Exit", enabler.getDartSiteId());
     

getDartSiteName() : String

Gets the DART site name.

     enabler.exitQueryString("Background Exit", enabler.getDartSiteName());
     

getDomainWhiteList() : Array

Returns the whitelisted domains for Studio.

getElapsedTime() : Number

Retrieves the amount of time that has elapsed in the ad if supported by the environment. This is currently only supported for linear in-stream creatives.

Expand
getFilename(originalFilename:String) : String

DEPRECATED

Gets the runtime file name given the original compile-time file name. The original file name may have been mapped to a newer file name.
     var fileName:String = enabler.getFilename(
         "AS3_300x250_test_snippets.swf");
     

Expand
getGlobalData(key:String) : Object

Retrieves data from the shared data object for sharing between classes and SWFs.

Expand
getParameter(variableName:String)

Retrieves a creative parameter which the user can pass via queryString URL. This is the public-facing version of getAdParameter, and does some pre-filtering based on nulls and empties.

     var stringParam:String = enabler.getParameter("stringParam");
     
For retrieving custom key-values, use of this method is deprecated. Use getCustomParameter instead.

Expand
getParameterAsInteger(name:String) : int

Retrieves a creative parameter as a typed integer.

     var intParam:Number = enabler.getParameterAsInteger("intParam");
     

Expand
getStreamingVideoUrl(originalFilename:String) : String

Gets the DART-hosted streaming URL to be used at runtime given an original child asset file name.

     var videoUrl:String = enabler.getStreamingVideoUrl("video.flv");
     

Expand
getUrl(filenameOrHttpUrl:String, httpsUrl:String=null) : String

Gets the runtime URL given the original compile-time filename.

     var url:String = enabler.getUrl("AS3_300x250_test_snippets.swf");
     

getUserAreaCode() : String

DEPRECATED

Returns the user's area code.
     var userAreaCode:String = enabler.getUserAreaCode();
     

getUserBandwidth() : int

Gets the user's bandwidth according to DART bandwidth codes.

     var userBandwidth:Number = enabler.getUserBandwidth();
     

getUserCountry() : String

Gets the two-letter string representation of the user's country, as defined by iso-3166-1 alpha 2.

     var userCountry:String = enabler.getUserCountry();
     

getUserDMACode() : String

Returns a DART representation of the user's Nielsen Designated Market Area.

     var userDmaCode:String = enabler.getUserDMACode();
     

getUserState() : String

Gets the two letter string representation of the user's state or province.

     var userState:String = enabler.getUserState();
     

getUserZipCode() : String

Gets the user's zip code (for users in the United States, U.S. Territories, and Canada).

     var userZipCode:String = enabler.getUserZipCode();
     

getVolume() : Number

Returns the volume that the environment requested the ad be set to if supported. Values of -1 indicate that there is no requested volume. This is currently only supported for linear in-stream creatives.

hasStarted() : Boolean

Accessor to find out if the ad has started.

hasUserInteracted() : Boolean

Indicates whether or not a user has interacted with the ad. If the user moused over the ad, we assume that the user interacted with it.

Expand
init(baseDisplayObject:flash.display:DisplayObject) : void

Initializes the Enabler.

isFlashFullScreenSupported() : Boolean

Indicates whether or not the system is compatible and enabled to launch into FullScreen mode.

     if (!enabler.isFlashFullScreenSupported()) {
       openFsButton.visible = false;
       closeFsButton.visible = false;
     }
     

isInFullScreen() : Boolean

Returns if the ad is currently in full screen mode.

isInitialized() : Boolean

Indicates whether or not the Enabler has initialized. This method is generally used by other Studio components.

     import com.google.ads.studio.events.StudioEvent;
      
     var enablerInitHandler:Function = function(event:StudioEvent):void {
       trace("Enabler initialized.");
     };
      
     if (enabler.isInitialized()) {
       trace("Enabler initialized.");
     } else {
       trace("Enabler not yet initialized.");
       enabler.addEventListener(StudioEvent.INIT, enablerInitHandler);
     }
     

isRunningLocally() : Boolean

Indicates whether or not the creative is running locally or off the ad serving platform.

     if (enabler.isRunningLocally()) {
       trace("Flash is running locally.");
     }
     

Expand
launchFullScreen(scaleMode:String=null, align:String=null, sourceRectangle:flash.geom:Rectangle=null) : void

Launches the creative in Flash's native fullscreen mode. Stage scale mode and align get reset to the original values when the creative exits fullscreen.

     var openFsClickHandler:Function = function(event:MouseEvent):void {
       enabler.launchFullScreen();
     };
     openFsButton.addEventListener(MouseEvent.CLICK, openFsClickHandler);
     

muteAllVideos() : void

Mutes all video controllers.

     var muteAllClickHandler:Function = function(event:MouseEvent):void {
       enabler.muteAllVideos();
     };
     muteAllButton.addEventListener(MouseEvent.CLICK, muteAllClickHandler);
     

pageHasLoaded() : Boolean

Indicates whether or not the host page has loaded.

     import com.google.ads.studio.events.StudioEvent;
      
     var pageLoadedHandler:Function = function(event:StudioEvent):void {
       trace("Page loaded.");
     };
      
     if (enabler.pageHasLoaded()) {
       trace("Page loaded.");
     } else {
       trace("Page not yet loaded.");
       enabler.addEventListener(StudioEvent.PAGE_LOADED, pageLoadedHandler);
     }
     

Expand
registerChargeableEventName(eventName:String) : void

Allows a creative to specify the event they wish to be charged on.

Expand
reportCustomClickVariable(postString:String) : void

DEPRECATED

This tracks a click against the string parameter. See: reportCustomVariableCount1(customString:String)

Expand
reportCustomImpressionVariable(postString:String) : void

DEPRECATED

Tracks an impression against the string parameter. See: reportCustomVariableCount1(postString:String)

Expand
reportCustomVariableCount1(customString:String) : void

Counts instances of the string parameter, aggregated as Custom Variable Count 1 in reports. The string must meet the following criteria:

  • The string cannot exceed 100 characters
  • The string must only contain Latin characters (0-9, Aa-Zz)
  • The string must NOT contain any personally identifiable information such as name, email address, phone number, health info, financial info, etc.
Additionally, all question marks (?) and anything after the first question mark in a string will be truncated.
     var siteName:String = enabler.getDartSiteName();
     enabler.reportCustomVariableCount1("Site Name: " + siteName);
     

Expand
reportCustomVariableCount2(customString:String) : void

Counts instances of the string parameter, aggregated as Custom Variable Count 2 in reports. The string must meet the following criteria:

  • The string cannot exceed 100 characters
  • The string must NOT contain any personally identifiable information such as name, email address, phone number, health info, financial info, etc.
Additionally, all question marks (?) and anything after the first question mark in a string will be truncated.
     var siteName:String = enabler.getDartSiteName();
      
     var customReportClickHandler:Function = function(
         event:MouseEvent):void {
       enabler.reportCustomVariableCount2("Site Name:  " + siteName);
     };
     customReportButton.addEventListener(
         MouseEvent.CLICK,
         customReportClickHandler);
     

reportManualClose() : void

Records a manual closing of a Floating, Pop-up, Expanding, In-Page with Pop-up, or In-Page with Floating ad.

     var closeClickHandler:Function = function(event:MouseEvent):void {
       enabler.reportManualClose();
       enabler.close();
     };
     closeButton.addEventListener(MouseEvent.CLICK, closeClickHandler);
     

Expand
setClipRegion(clipRect:flash.geom:Rectangle) : void

Sets the region of the ad that should still be visible when the ad is collapsed. Only used if the environment supports this. The function is considered internal and shouldn't be called directly. Use the expanding component instead.

Expand
setDefaultFullScreenAlign(align:String) : void

Sets the default full screen stage align. Useful when using full screen buttons where you don't explicitly invoke #launchFullScreen.

Expand
setDefaultFullScreenScaleMode(scaleMode:String) : void

Sets the default full screen scale mode. Useful when using full screen buttons where you don't explicitly invoke #launchFullScreen.

Expand
setDuration(duration:Number) : void

Updates and sets the total duration of the ad if supported by the environment. This is currently only supported for linear in-stream creatives.

Expand
setElapsedTime(elapsedTime:Number) : void

Updates and reports the amount of time that has elapsed in the ad if supported by the environment. This is currently only supported for linear in-stream creatives.

Expand
setExpanded(expanded:Boolean) : void

Updates and reports the expanded state of the ad if supported by the environment. This method is considered internal and shouldn't be called directly. Use the expanding component instead.

Expand
setFullScreenSourceRectangle(sourceRectangle:flash.geom:Rectangle) : void

Sets the default full screen source rectangle. Useful when using full screen buttons where you don't explicitly invoke #launchFullScreen.

Expand
setGlobalData(key:String, data:Object) : void

Sets data that can be accessed between classes and SWFs.

Expand
setHint(name:String, value:Object=null) : AbstractEnabler

Sets a predefined hint to be parsed on upload of the creative.

Expand
setLinear(linear:Boolean) : void

Updates and reports the linear state of the ad if supported by the environment. This should only be used by VPAID ads that are initially non-linear.

Expand
setSkippable(skippable:Boolean) : void

Updates and reports the skippable state of the ad if supported by the environment. This is currently only supported for linear in-stream creatives.

Expand
setVolume(volume:Number) : void

Updates and sets the current volume of the ad. This is currently only supported for linear in-stream creatives.

Expand
startTimer(timerId:String) : void

Starts an event timer.

     var mainPanelMouseoverHandler:Function = function(
         event:MouseEvent):void {
       enabler.startTimer("Roll Button Timer");
     };
     mainPanel.addEventListener(
         MouseEvent.MOUSE_OVER,
         mainPanelMouseoverHandler);
     

stopAllVideos() : void

Stops all video controllers.

     var stopAllClickHandler:Function = function(event:MouseEvent):void {
       enabler.stopAllVideos();
     };
     stopAllButton.addEventListener(MouseEvent.CLICK, stopAllClickHandler);
     

Expand
stopTimer(timerId:String) : void

Stops an event timer.

     var mainPanelMouseoutHandler:Function = function(
         event:MouseEvent):void {
       enabler.stopTimer("Main Panel Timer");
     };
     mainPanel.addEventListener(
         MouseEvent.MOUSE_OUT,
         mainPanelMouseoutHandler);
     

waitForLoad() : void

This method increments the count of assets that are currently loading. It should be called right before you begin loading an asset necessary for the initial display of the creative. When the asset is finished loading, a corresponding call to finishedLoad() must be made.

     enabler.waitForLoad();
     var urlRequest:URLRequest = new URLRequest(URL);
     var urlLoader:URLLoader = new URLLoader();
     urlLoader.addEventListener(Event.COMPLETE, urlLoadedHandler);
     urlLoader.addEventListener(IOErrorEvent.IO_ERROR, urlErrorHandler);
     urlLoader.load(urlRequest);
          function urlLoadedHandler(event:Event):void {
       enabler.finishedLoad();
       // Use loaded asset
     }
          function urlErrorHandler(event:Event):void {
       enabler.finishedLoad();
       // Handle error
     }
     

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