DoubleClick Studio AS3 API Reference

class com.google.ads.studio.events.StudioEvent

The StudioEvent class is used to create events that are fired by DoubleClick Studio components. The aim is to have all components firing events of type StudioEvent, however each event instance can potentially have different properties from the next one. Why did we opt to use a dynamic class, instead of creating several different specific event classes? Well, overall byte size of the components is a major issue. By placing all type definitions in this single dynamic class, we keep the overall byte size of the library down.

Constants

NameValueDescription
AFTER_REMOVED_FROM_STAGEafterRemovedFromStage

Dispatched after the display object has been removed from the stage.

     import com.google.ads.studio.events.StudioEvent;
     import com.google.ads.studio.configurable.Configurable;
      
     var removedFromStageHandler:Function = function(event:StudioEvent):void {
       trace(stage); // "null" is output
     };
      
     enabler.addEventListener(
         StudioEvent.AFTER_REMOVED_FROM_STAGE,
         removedFromStageHandler);
     

BEGIN_COLLAPSINGbeginCollapsing

The StudioEvent.BEGIN_COLLAPSING property defines the value of the type property of the event object for an beginCollapsing event. The event gets fired when the ad should begin the collapse animation.

     import com.google.ads.studio.events.StudioEvent;
      
     var enablerBeginCollapsingHandler:Function =
         function(event:StudioEvent):void {
       // Begin the collapse animations here. If there are no animations,
       // just set the ad to its collapsed state.
       trace("Ad began collapsing.");
     };
     enabler.addEventListener(StudioEvent.BEGIN_COLLAPSING,
         enablerBeginCollapsingHandler);
     

BEGIN_EXPANDINGbeginExpanding

The StudioEvent.BEGIN_EXPANDING property defines the value of the type property of the event object for an beginExpanding event. The event gets fired when the ad should begin the expand animation.

     import com.google.ads.studio.events.StudioEvent;
      
     var enablerBeginExpandingHandler:Function =
         function(event:StudioEvent):void {
       // Begin the expand animations here. If there are no animations,
       // just set the ad to its expanded state.
       trace("Ad began expanding.");
     };
     enabler.addEventListener(StudioEvent.BEGIN_EXPANDING,
         enablerBeginExpandingHandler);
     

CHANGE_INPUT_VARIABLEchangeInputVariable

The StudioEvent.CHANGE_INPUT_VARIABLE property defines the value of the type property of the event object for a changeInputVariable event. The event gets fired when one of the Flash vars gets changed from the JavaScript.

COLLAPSE_BEGINcollapseBegin

The StudioEvent.COLLAPSE_BEGIN property defines the value of the type property of the event object for a collapseBegin event. The event gets fired when the creative collapse has begun.

     import com.google.ads.studio.events.StudioEvent;
      
     var collapseBeginHandler:Function = function(event:StudioEvent):void {
       trace("Collapse begins.");
     };
     expanding.addEventListener(
         StudioEvent.COLLAPSE_BEGIN,
         collapseBeginHandler);
     

COLLAPSE_COMPLETEcollapseComplete

The StudioEvent.COLLAPSE_COMPLETE property defines the value of the type property of the event object for a collapseComplete event. The event gets fired when the creative collapse has completed.

     import com.google.ads.studio.events.StudioEvent;
      
     var collapseCompleteHandler:Function = function(
         event:StudioEvent):void {
       trace("Collapse completed.");
     };
     expanding.addEventListener(
         StudioEvent.COLLAPSE_COMPLETE,
         collapseCompleteHandler);
     

CONNECTconnect

The StudioEvent.CONNECT property defines the value of the type property of the event object for a connect event. The event gets fired when a connection has been established.

     import com.google.ads.studio.events.StudioEvent;
      
     var connectHandler:Function = function(event:StudioEvent):void {
       trace("Connection succeeded.");
     };
     lcComponentInstance.addEventListener(
         StudioEvent.CONNECT,
         connectHandler);
     

CONTEXT_FAILcontextFail

Dispatched when retrieval of contextual data fails for any reason.

     import com.google.ads.studio.ContextualDiscovery;
     import com.google.ads.studio.events.StudioEvent;
      
     var failHandler:Function = function(event:StudioEvent):void {
       trace("Component failed to intialize.");
     };
     ContextualDiscovery.getInstance().addEventListener(
         StudioEvent.CONTEXT_FAIL,
         failHandler);
     

CONTEXT_LOADcontextLoad

Dispatched when the contextual data is available.

The properties of the event object have the following values:

PropertyValue
termsThe keyword terms associated with the page context.
latitudeThe detected latitude of the user.
longitudeThe detected longitude of the user.
     import com.google.ads.studio.ContextualDiscovery;
     import com.google.ads.studio.events.StudioEvent;
      
     var terms:Array;
     var latitude:Number;
     var longitude:Number;
     var dataHandler:Function = function(dataEvent:StudioEvent):void {
       terms = dataEvent.terms;
       latitude = dataEvent.latitude as Number;
       longitude = dataEvent.longitude as Number;
     };
      
     ContextualDiscovery.getInstance().addEventListener(
         CONTEXT_LOAD,
         dataHandler);
     ContextualDiscovery.getInstance().discoverContext();
     

DATA_RECEIVEDdataReceived

The StudioEvent.DATA_RECEIVED property defines the value of the type property of the event object for a dataReceived event. The event gets fired when data has been received.

     import com.google.ads.studio.events.StudioEvent;
      
     var dataReceivedHandler:Function = function(event:StudioEvent):void {
       trace("Data sent.");
       trace("Sender is " + event.sender + ".");
       trace("Message is " + event.data + ".");
     };
     lcComponentInstance.addEventListener(
         StudioEvent.DATA_RECEIVED,
         dataReceivedHandler);
     

EXITexit

The StudioEvent.EXIT property defines the value of the type property of the event object for an exit event. The event gets fired when the creative invokes a clickthrough exit.

     import com.google.ads.studio.events.StudioEvent;
      
     var exitHandler:Function = function(event:StudioEvent):void {
       trace("Exit clicked.");
     };
     enabler.addEventListener(StudioEvent.EXIT, exitHandler);
     

EXPANDexpand

The StudioEvent.EXPAND property defines the value of the type property of the event object for an expand event. The event gets fired when the creative has expanded.

     import com.google.ads.studio.events.StudioEvent;
      
     var expandHandler:Function = function(event:StudioEvent):void {
       trace("Ad expanded.");
     };
     expanding.addEventListener(StudioEvent.EXPAND, expandHandler);
     

F2F_CUSTOM_EVENTf2fCustomEvent

The StudioEvent.F2F_CUSTOM_EVENT property defines the value of the type property of the event object for a f2fCustomEvent event. The event gets fired when the F2fEnabler is reporting a custom event to the IMA SDK.

FAILfail

The StudioEvent.FAIL property defines the value of the type property of the event object for a fail event. The event gets fired when an operation has failed.

     import com.google.ads.studio.events.StudioEvent;
      
     var failHandler:Function = function(event:StudioEvent):void {
       trace("Component failed to intialize.");
     };
     component.addEventListener(StudioEvent.FAIL, failHandler);
     

FULL_SCREENfullScreen

The StudioEvent.FULL_SCREEN property defines the value of the type property of the event object for a fullScreen event. The event gets fired when the creative goes fullScreen.

     import com.google.ads.studio.events.StudioEvent;
      
     var fsOpenHandler:Function = function(event:StudioEvent):void {
       trace("Fullscreen opened.");
     };
     enabler.addEventListener(StudioEvent.FULL_SCREEN, fsOpenHandler);
     

FULL_SCREEN_EXITfullScreenExit

The StudioEvent.FULL_SCREEN_EXIT property defines the value of the type property of the event object for a fullScreenExit event. The event gets fired when the creative returns from fullScreen mode.

     import com.google.ads.studio.events.StudioEvent;
      
     var fsCloseHandler:Function = function(event:StudioEvent):void {
       trace("Fullscreen closed.");
     };
     enabler.addEventListener(StudioEvent.FULL_SCREEN_EXIT, fsCloseHandler);
     

INITinit

The StudioEvent.INIT property defines the value of the type property of the event object for an init event. The event gets fired when an object has finished initializing.

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

INTERACTIONinteraction

The StudioEvent.INTERACTION property defines the value of the type property of the event object for an interaction event. The event gets fired when the user has interacted with the ad.

     import com.google.ads.studio.events.StudioEvent;
      
     var enablerInteractionHandler:Function = function(
         event:StudioEvent):void {
       trace("User interacted.");
     };
     enabler.addEventListener(
         StudioEvent.INTERACTION,
         enablerInteractionHandler);
     

LAYOUT_CHANGEDlayoutChanged

The StudioEvent.LAYOUT_CHANGED property defines the value of the type property of the event object for a layoutChanged event. The event gets fired whenever a value has been changed in the layout's placeholder. This will usually happen during live preview of the layout.

     import com.google.ads.studio.events.StudioEvent;
      
     var layoutChangedHandler:Function = function(event:StudioEvent):void {
       // Update any components that use layouts.placeholder and aren't
       // already using binding!
     };
     enabler.addEventListener(StudioEvent.LAYOUT_CHANGED,
                              layoutChangedHandler);
     

LOADload

The StudioEvent.LOAD property defines the value of the type property of the event object for a load event. The event gets fired when an object has loaded.

     import com.google.ads.studio.events.StudioEvent;
      
     var loadHandler:Function = function(event:StudioEvent):void {
       trace("Loaded.");
     };
     loaderInstance.addEventListener(StudioEvent.LOAD, loadHandler);
     

LOAD_INITloadInit

The StudioEvent.LOAD_INIT property defines the value of the type property of the event object for a loadInit event. The event gets fired when an object has begun to load.

MAP_FAILmapFail

Dispatched when the map has failed to load.

     import com.google.ads.studio.events.StudioEvent;
      
     var mapFailedHandler:Function = function(event:StudioEvent):void {
       trace("Map failed. Showing alternative content.");
     };
     studioMapInstance.addEventListener(
         StudioEvent.MAP_FAIL,
         mapFailedHandler);
     

MAP_LOADmapLoad

Dispatched when users location is loaded.

The properties of the event object have the following values:

PropertyValue
locationThe LatLng location of the center of the map.
     import com.google.ads.studio.events.StudioEvent;
     import com.google.maps.LatLng;
      
     var locationHandler:Function = function(event:StudioEvent = null):void {
       trace("Location loaded:" + studioMapInstance.getLocation().toString());
     };
     if (studioMapInstance.getLocation()) {
       locationHandler();
     } else {
       studioMapInstance.addEventListener(
           StudioEvent.MAP_LOAD,
           locationHandler);
     }
     

MAP_PREINITmapPreInit

Dispatched when the map is ready to have its init options set.

     import com.google.ads.studio.events.StudioEvent;
     import com.google.maps.MapOptions;
     import com.google.maps.MapType;
      
     var mapPreInitializeHandler:Function = function(event:StudioEvent):void {
       var mapOptions:MapOptions = new MapOptions();
       mapOptions.mapType = MapType.NORMAL_MAP_TYPE;
       studioMapInstance.setInitOptions(mapOptions);
     };
     studioMapInstance.addEventListener(StudioEvent.MAP_PREINIT,
                                        mapPreInitializeHandler);
     

PAGE_LOADEDpageLoaded

The StudioEvent.PAGE_LOADED property defines the value of the type property of the event object for a pageLoaded event. The event gets fired when the HTML page which embeds the creative has finished loading.

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

PAUSEpause

The StudioEvent.PAUSE property defines the value of the type property of the event object for an pause event. The event gets fired when the ad should pause.

     import com.google.ads.studio.events.StudioEvent;
      
     var enablerPauseHandler:Function = function(event:StudioEvent):void {
       // Pause all animations here.
       trace("Ad paused.");
     };
     enabler.addEventListener(StudioEvent.PAUSE, enablerPauseHandler);
     

REPORT_EVENTreportEvent

The StudioEvent.REPORT_EVENT property defines the value of the type property of the event object for a reportEvent event. The event gets fired when a metric event is reported.

REPORT_FLUSH_EVENTreportFlushEvent

The StudioEvent.REPORT_FLUSH_EVENT property defines the value of the type property of the event object for a reportFlushEvent event. The event gets fired when the F2fEnabler is reporting a flush operation.

RESUMEresume

The StudioEvent.RESUME property defines the value of the type property of the event object for an resume event. The event gets fired when the ad should resume playing.

     import com.google.ads.studio.events.StudioEvent;
      
     var enablerResumeHandler:Function = function(event:StudioEvent):void {
       // Resume animations here.
       trace("Ad resumed.");
     };
     enabler.addEventListener(StudioEvent.RESUME, enablerResumeHandler);
     

SCENE_ACTIVEsceneActive

Dispatched just before the Layouts component activates a scene.

The properties of the event object have the following values:

PropertyValue
isDynamicIndicates if the scene is dynamic.
sceneNameThe name of the new scene. Registration id for dynamic scenes.
parentThe configurable display object that declares the array, in case of dynamic scenes.
     import com.google.ads.studio.events.StudioEvent;
     import com.google.ads.studio.layouts.Layouts;
      
     var sceneChangeHandler:Function = function(event:StudioEvent):void {
       if (event.isDynamic) {
         // Make sure the scene's parent object is on display.
         var sceneParentObject:DisplayObject = event.parent;
         clearStage();
         addChild(sceneParentObject);
         trace("A dynamic scene is now active:" + event.sceneName);
       } else {
         trace("A scene is now active:" + event.sceneName);
       }
     };
      
     Layouts.getInstance().addEventListener(
         StudioEvent.SCENE_ACTIVE,
         sceneChangeHandler);
     

STAGE_MOUSE_OUTstageMouseOut

The StudioEvent.STAGE_MOUSE_OUT property defines the value of the type property of the event object for a stageMouseOut event. The event gets fired when the user mouses out of the creative.

     import com.google.ads.studio.events.StudioEvent;
      
     var stageMouseOutHandler:Function = function(event:StudioEvent):void {
       trace("Mouse out.");
     };
     enabler.addEventListener(
         StudioEvent.STAGE_MOUSE_OUT,
         stageMouseOutHandler);
     

STAGE_MOUSE_OVERstageMouseOver

The StudioEvent.STAGE_MOUSE_OVER property defines the value of the type property of the event object for a stageMouseOver event. The event gets fired when the user mouses over the creative.

     import com.google.ads.studio.events.StudioEvent;
      
     var stageMouseOverHandler:Function = function(event:StudioEvent):void {
       trace("Mouse over.");
     };
     enabler.addEventListener(
         StudioEvent.STAGE_MOUSE_OVER,
         stageMouseOverHandler);
     

STARTstart

The StudioEvent.START property defines the value of the type property of the event object for an start event. The event gets fired when the ad is allowed to start.

     import com.google.ads.studio.events.StudioEvent;
      
     var enablerStartHandler:Function = function(event:StudioEvent):void {
       trace("Ad started.");
       // Start animation now.
     };
     enabler.addEventListener(StudioEvent.START, enablerStartHandler);
     

STATE_ACTIVEstateActive

Dispatched just before the Layouts component activates a state (scene).

The properties of the event object have the following values:

PropertyValue
isDynamicIndicates if the state is dynamic.
stageNameThe name of the new state. Registration id for dynamic states.
parentThe configurable display object that declares the array, in case of dynamic states.
     import com.google.ads.studio.events.StudioEvent;
     import com.google.ads.studio.configurable.Configurable;
      
     var stageChangeHandler:Function = function(event:StudioEvent):void {
       if (event.isDynamic) {
         // Make sure the stage's parent object is on display.
         var stageParentObject:DisplayObject = event.parent;
         clearStage();
         addChild(stageParentObject);
         trace("A dynamic stage is now active:" + event.stageName);
       } else {
         trace("A stage is now active:" + event.stageName);
       }
     };
      
     Configurable.getInstance().addEventListener(
         StudioEvent.STATE_ACTIVE,
         stageChangeHandler);
     

STOPstop

The StudioEvent.STOP property defines the value of the type property of the event object for an stop event. The event gets fired when the ad is supposed to stop playing and clean up.

     import com.google.ads.studio.events.StudioEvent;
      
     var enablerStopHandler:Function = function(event:StudioEvent):void {
       trace("Ad stopped.");
       // Stop animations, videos, and audio, and clean up.
     };
     enabler.addEventListener(StudioEvent.STOP, enablerStopHandler);
     

TIMEOUTtimeout

The StudioEvent.TIMEOUT property defines the value of the type property of the event object for a timeout event. The event gets fired when a timeout occurs.

     import com.google.ads.studio.events.StudioEvent;
      
     var timeoutHandler:Function = function(event:StudioEvent):void {
       trace("Connection failed.");
     };
     lcComponentInstance.addEventListener(
         StudioEvent.TIMEOUT,
         timeoutHandler);
     

UPDATEupdate

The Event.UPDATE property defines the value of the type property of the event object for a update event. The event gets fired when an update occurs.

     import com.google.ads.studio.video.EnhancedVideoController;
     import com.google.ads.studio.video.Playlist;
     import com.google.ads.studio.events.StudioEvent;
      
     var videoController:EnhancedVideoController =
         videoComponentInstance.getCurrentVideoController();
     var playlist:Playlist = videoComponentInstance.getPlaylist();
      
     var videoControllerChangeHandler:Function = function(
         event:StudioEvent):void {
       videoController = videoComponentInstance.getCurrentVideoController();
       trace("Video controller has changed.");
     };
     playlist.addEventListener(
         StudioEvent.UPDATE,
         videoControllerChangeHandler);
     

VOLUME_CHANGEvolumeChange

The StudioEvent.VOLUME_CHANGE property defines the value of the type property of the event object for an volumeChange event. The event gets fired when the ad should update its volume.

     import com.google.ads.studio.events.StudioEvent;
      
     var enablerVolumeChangeHandler:Function =
         function(event:StudioEvent):void {
       // set video.volume to event.volume
       trace("Volume changed.");
     };
     enabler.addEventListener(StudioEvent.VOLUME_CHANGE,
         enablerVolumeChangeHandler);
     

Constructors

Expand
StudioEvent(type:String)

Creates a StudioEvent object to pass as a parameter to event listeners.

Instance Methods

Defined in com.google.ads.studio.events:StudioEvent

Expand
addProperty(key:String, value:Object) : StudioEvent

Adds a key value property to the event object.

getLogLevel() : int

Gets the logging level associated with the StudioEvent.

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