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
Name | Value | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
AFTER_REMOVED_FROM_STAGE | afterRemovedFromStage | 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_COLLAPSING | beginCollapsing |
The StudioEvent.BEGIN_COLLAPSING property defines the value of the
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_EXPANDING | beginExpanding |
The StudioEvent.BEGIN_EXPANDING property defines the value of the
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_VARIABLE | changeInputVariable |
The StudioEvent.CHANGE_INPUT_VARIABLE property defines the value of the
| ||||||||
COLLAPSE_BEGIN | collapseBegin |
The StudioEvent.COLLAPSE_BEGIN property defines the value of the
import com.google.ads.studio.events.StudioEvent; var collapseBeginHandler:Function = function(event:StudioEvent):void { trace("Collapse begins."); }; expanding.addEventListener( StudioEvent.COLLAPSE_BEGIN, collapseBeginHandler); | ||||||||
COLLAPSE_COMPLETE | collapseComplete |
The StudioEvent.COLLAPSE_COMPLETE property defines the value of the
import com.google.ads.studio.events.StudioEvent; var collapseCompleteHandler:Function = function( event:StudioEvent):void { trace("Collapse completed."); }; expanding.addEventListener( StudioEvent.COLLAPSE_COMPLETE, collapseCompleteHandler); | ||||||||
CONNECT | connect |
The StudioEvent.CONNECT property defines the value of the
import com.google.ads.studio.events.StudioEvent; var connectHandler:Function = function(event:StudioEvent):void { trace("Connection succeeded."); }; lcComponentInstance.addEventListener( StudioEvent.CONNECT, connectHandler); | ||||||||
CONTEXT_FAIL | contextFail | 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_LOAD | contextLoad | Dispatched when the contextual data is available. The properties of the event object have the following values:
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_RECEIVED | dataReceived |
The StudioEvent.DATA_RECEIVED property defines the value of the
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); | ||||||||
EXIT | exit |
The StudioEvent.EXIT property defines the value of the
import com.google.ads.studio.events.StudioEvent; var exitHandler:Function = function(event:StudioEvent):void { trace("Exit clicked."); }; enabler.addEventListener(StudioEvent.EXIT, exitHandler); | ||||||||
EXPAND | expand |
The StudioEvent.EXPAND property defines the value of the
import com.google.ads.studio.events.StudioEvent; var expandHandler:Function = function(event:StudioEvent):void { trace("Ad expanded."); }; expanding.addEventListener(StudioEvent.EXPAND, expandHandler); | ||||||||
F2F_CUSTOM_EVENT | f2fCustomEvent |
The StudioEvent.F2F_CUSTOM_EVENT property defines the value of the
| ||||||||
FAIL | fail |
The StudioEvent.FAIL property defines the value of the
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_SCREEN | fullScreen |
The StudioEvent.FULL_SCREEN property defines the value of the
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_EXIT | fullScreenExit |
The StudioEvent.FULL_SCREEN_EXIT property defines the value of the
import com.google.ads.studio.events.StudioEvent; var fsCloseHandler:Function = function(event:StudioEvent):void { trace("Fullscreen closed."); }; enabler.addEventListener(StudioEvent.FULL_SCREEN_EXIT, fsCloseHandler); | ||||||||
INIT | init |
The StudioEvent.INIT property defines the value of the
import com.google.ads.studio.events.StudioEvent; var enablerInitHandler:Function = function(event:StudioEvent):void { trace("Enabler initialized."); }; enabler.addEventListener(StudioEvent.INIT, enablerInitHandler); | ||||||||
INTERACTION | interaction |
The StudioEvent.INTERACTION property defines the value of the
import com.google.ads.studio.events.StudioEvent; var enablerInteractionHandler:Function = function( event:StudioEvent):void { trace("User interacted."); }; enabler.addEventListener( StudioEvent.INTERACTION, enablerInteractionHandler); | ||||||||
LAYOUT_CHANGED | layoutChanged |
The StudioEvent.LAYOUT_CHANGED property defines the value of the
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); | ||||||||
LOAD | load |
The StudioEvent.LOAD property defines the value of the
import com.google.ads.studio.events.StudioEvent; var loadHandler:Function = function(event:StudioEvent):void { trace("Loaded."); }; loaderInstance.addEventListener(StudioEvent.LOAD, loadHandler); | ||||||||
LOAD_INIT | loadInit |
The StudioEvent.LOAD_INIT property defines the value of the
| ||||||||
MAP_FAIL | mapFail | 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_LOAD | mapLoad | Dispatched when users location is loaded. The properties of the event object have the following values:
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_PREINIT | mapPreInit | 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_LOADED | pageLoaded |
The StudioEvent.PAGE_LOADED property defines the value of the
import com.google.ads.studio.events.StudioEvent; var pageLoadedHandler:Function = function(event:StudioEvent):void { trace("Page loaded."); }; enabler.addEventListener(StudioEvent.PAGE_LOADED, pageLoadedHandler); | ||||||||
PAUSE | pause |
The StudioEvent.PAUSE property defines the value of the
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_EVENT | reportEvent |
The StudioEvent.REPORT_EVENT property defines the value of the
| ||||||||
REPORT_FLUSH_EVENT | reportFlushEvent |
The StudioEvent.REPORT_FLUSH_EVENT property defines the value of the
| ||||||||
RESUME | resume |
The StudioEvent.RESUME property defines the value of the
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_ACTIVE | sceneActive | Dispatched just before the Layouts component activates a scene. The properties of the event object have the following values:
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_OUT | stageMouseOut |
The StudioEvent.STAGE_MOUSE_OUT property defines the value of the
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_OVER | stageMouseOver |
The StudioEvent.STAGE_MOUSE_OVER property defines the value of the
import com.google.ads.studio.events.StudioEvent; var stageMouseOverHandler:Function = function(event:StudioEvent):void { trace("Mouse over."); }; enabler.addEventListener( StudioEvent.STAGE_MOUSE_OVER, stageMouseOverHandler); | ||||||||
START | start |
The StudioEvent.START property defines the value of the
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_ACTIVE | stateActive | Dispatched just before the Layouts component activates a state (scene). The properties of the event object have the following values:
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); | ||||||||
STOP | stop |
The StudioEvent.STOP property defines the value of the
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); | ||||||||
TIMEOUT | timeout |
The StudioEvent.TIMEOUT property defines the value of the
import com.google.ads.studio.events.StudioEvent; var timeoutHandler:Function = function(event:StudioEvent):void { trace("Connection failed."); }; lcComponentInstance.addEventListener( StudioEvent.TIMEOUT, timeoutHandler); | ||||||||
UPDATE | update |
The Event.UPDATE property defines the value of the
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_CHANGE | volumeChange |
The StudioEvent.VOLUME_CHANGE property defines the value of the
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
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
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.