DoubleClick Studio AS3 API Reference

class com.google.ads.studio.layouts.Layouts

Extends com.google.ads.studio:EnabledComponent

Layouts allows designers to define a layout which can be customized by Studio users.

Register a configurable instance of a class:

   import com.google.ads.studio.layouts.Layouts;

    

   var image:Image = new Image();

   var tooltip:ToolTip = new ToolTip();

   image.addChild(tooltip);

   
   // Register image at the "root" level of the layout.

   Layouts.getInstance().register("top image", image);

   
   // Register tooltip nested inside of image.

   Layouts.getInstance().register("tooltip", tooltip, image);

   

Constants

NameValueDescription
ARRAY_ADD_TAGConfigurableArrayAdd
ARRAY_DISPOSE_TAGConfigurableArrayDispose

Layouts meta-tags

ARRAY_REMOVE_TAGConfigurableArrayRemove
ASSET_ID_TAGassetId
CHANGE_VALUE_FUNCTIONchangeValue
FIELD_META_TAGConfigurable
GWT_INVOKE_FUNCTIONwindow.layoutsPreviewManager.invokeLayoutGwtFunction
HIDE_NODE_FUNCTIONhideNode
LAYOUTS_PREVIEW_ENVIRONMENTlayoutsPreviewEnv
PLAYER_TYPE_ACTIVEXActiveX
PLAYER_TYPE_PLUGINPlugIn
REDRAW_META_TAGConfigurableUpdate
SAFE_LAYOUTS_CONFIG_INDICATOR\x3clayout
SET_ACTIVE_SCENE_FUNCTIONsetActiveScene
SHOW_NODE_FUNCTIONshowNode
TYPE_BOOLEANbool
TYPE_COLORcolor
TYPE_DOUBLEdouble
TYPE_LONGlong
VALUE_FLASHVARS_NAMElayoutsConfig

The flashvars variable name for the values.

VIDEO_REPORTING_IDENTIFIERvideoReportingIdentifier
instance

The singleton instance of the Layouts class.

Properties

NameTypeDescriptionDefault
detachedRootsToChildrenDictionary
scenesMapObjectunknown

Expand Events

Static Methods

Layouts.getInstance() : Layouts

Returns the singleton instance of the Layouts class.

Instance Methods

Defined in: com.google.ads.studio:EnabledComponent

getEnabler() : Object
isInitialized() : Boolean

Returns whether the component has initialized.

Defined in com.google.ads.studio.layouts:Layouts

Expand
addArrayValues(id:String, arrayName:String, valueContainers:Array, classNames:Array=null) : int

Add an array element value object for a configurable display object.

Expand
addTestArrayValues(id:String, arrayName:String, valueContainers:Array, classNames:Array=null) : int

For testing, add an array element value object for a configurable display object.

Add an array element value for a configurable array:

     import com.google.ads.studio.layouts.Layouts;

      

     layouts.addTestArrayValues("left gallery", "images",

                                [{imageTitle:"doggy",

                                  description:"running",

                                  url:"dog1.jpg"},

                                 {imageTitle:"kitty",

                                  description:"sleeping",

                                  url:"cat1.jpg"}],

                                ["Image", "Image"]);

     

Expand
changeFillerValue(registrationId:String, value:Object) : void

Change the value of a configurable display object in the filler. Sets the value on the registered object if found, but does not call any ConfigurableUpdate.

Change the value of the properties on configurable object video in the filler.

     import com.google.ads.studio.layouts.Layouts;

      

     // Register the object with layouts.

     var layouts:Layouts = Layouts.getInstance();

     layouts.register("video", video, "Video");

     // ...

     layouts.changeFillerValue(layouts.getRegistrationId(video),

         {videoUrl: "www.google.com"});

     

Expand
counter(displayObject:flash.display:DisplayObject, eventId:String, isCumulative:Boolean=false) : void

Tracks a counter event for a registered display object in the layout. Use this function if you want to allow tracking different counters for multiple instances of the same type.


     var expandClickHandler:Function = function(event:MouseEvent):void {

       layouts.counter(event.target, "Expand Counter");

       images[i].expand();

     };

     for each (var button:Sprite in expandButtons) {

       button.addEventListener(MouseEvent.CLICK, expandClickHandler);

     }

     

Expand
exit(displayObject:flash.display:DisplayObject, exitId:String) : void

Tracks an exit event for a registered display object in the layout.


     var linkClickHandler:Function = function(event:MouseEvent):void {

       layouts.exit(event.target, "Click Exit");

     };

     for each (var link:Sprite in links) {

       link.addEventListener(MouseEvent.CLICK, linkClickHandler);

     }

     

Expand
getDisplayObject(id:String) : DisplayObject

Gets the display object that was registered by the given id.

Expand
getDto(id:String) : DisplayObjectDto

Gets the {

Expand
getRegistrationId(displayObjectOrId:, parent:flash.display:DisplayObject=null, propertyName:String=null) : String

Get the registration id for a display object or property.

getRuntimeMode() : RuntimeMode

Indicates the runtime mode the layout asset is running in. Use this property to determine whether certain behaviors of the ad should be enabled or not, according to the runtime mode.

Expand
getValue(displayObjectOrId:, parent:flash.display:DisplayObject=null) : Object

Returns the primitive value object container for the given display object or display object ID.

Expand
hasValue(registerId:String, parent:flash.display:DisplayObject=null) : Boolean

Checks whether a value has been set for a display object. Use this function for optional display objects, to determine whether they should be created and registered to the parent or not.

Expand
hideFiller(registrationId:String) : void

Hide a configurable display object or a property on a configurable display object in the filler.

Hide property "videoUrl" on configurable object video in the filler.

     import com.google.ads.studio.layouts.Layouts;

      

     // Register the object with layouts.

     var layouts:Layouts = Layouts.getInstance();

     layouts.register("video", video, "Video");

     // ...

     layouts.hideFiller(layouts.getRegistrationId(video, null, "videoUrl");

     

Expand
isRegistered(displayObject:flash.display:DisplayObject) : Boolean

Returns true if the display object has already been registered with layouts.

Expand
isStoredAsDetachedRoot(displayObject:flash.display:DisplayObject) : Boolean

Returns true if the display object has already been detected as a detached root.

Expand
register(name:String, displayObject:flash.display:DisplayObject, fullyQualifiedType:String, parent:flash.display:DisplayObject=null, parentFullyQualifiedType:String=null) : String

Register a configurable display object.

Register a configurable display object:

     import com.google.ads.studio.layouts.Layouts;

      

     var image:Image = new Image();

     var tooltip:ToolTip = new ToolTip();

     image.addChild(tooltip);

     
     // Register image at the "root" level of the layout.

     Layouts.getInstance().register("top image", image, "com.ads.Image");

     
     // Register tooltip nested inside of image.

     Layouts.getInstance().register("tooltip", tooltip, "com.ads.Tooltip",

         image, "com.ads.Image");

     

Expand
registerDynamicScene(name:String, activateFunction:Function, parent:flash.display:DisplayObject) : void

Register a dynamic scene. Use for each array item.

Register a dynamic scene:

     import com.google.ads.studio.layouts.Layouts;

      

     [ConfigurableArrayAdd(id="Tabs", type="com.display.Tab")]

     [DynamicScenes]

     public function addTab(id:String):void {

       // Some code that creates and registers the new tab.

       var tab:Tab = new Tab();

       Layouts.getInstance().register(id, tab, this);

       addChild(tab);

     
       // Register a scene for the new tab.

       var selectTab:Function = function() {selectTab(tab);};

       Layouts.getInstance().registerDynamicScene(id, selectTab, this);

     }

     

Expand
registerScene(name:String, activateFunction:Function) : void

Register a scene.

Register a scene:

     import com.google.ads.studio.layouts.Layouts;

      

     var startVideo:Function = function() {

         clearStage();

         addChild(video);

         video.play(0);

     };

     
     // Register the intro video as a scene, specifying startVideo as the

     // activate scene function.

     Layouts.getInstance().registerScene("Intro Video", startVideo);

     

Expand
reportError(error:Error=null) : String

Reports a runtime error, caused by running the user layout code.

Expand
setActiveScene(name:String, arrayParent:flash.display:DisplayObject=null) : void

Notify Layouts that a scene has become active.

Notify Layouts that a scene had become active:

     import com.google.ads.studio.layouts.Layouts;

      

     // Register the start video function.

     var startVideo:Function = function() {

         clearStage();

         addChild(video);

         video.play(0);

         Layouts.getInstance().sceneActive("Intro Video");

     };

     Layouts.getInstance().registerScene("Intro Video", startVideo);

     

Expand
setLayoutsValue(id:String, valueContainer:Object) : void
Expand
setTestValue(id:String, valueContainer:Object) : void

Sets a test value for local IDE testing for a configurable display object.

Set a value for a configurable display object:

     import com.google.ads.studio.layouts.Layouts;

      

     layouts.setTestValue("top image", {imageTitle:"lion",

                                        description:"roars",

                                        url:"lion.jpg"});

     

Expand
setUpNewObject(id:String, displayObject:flash.display:DisplayObject, fullyQualifiedType:String, detachedRoot:flash.display:DisplayObject=null) : String

Initializes a newly registered display object for layouts, storing the appropriate information and building an id for it.

Expand
showFiller(registrationId:String) : void

Show a configurable display object or a property on a configurable display object in the filler.

Show property "videoUrl" on configurable object video in the filler.

     import com.google.ads.studio.layouts.Layouts;

      

     // Register the object with layouts.

     var layouts:Layouts = Layouts.getInstance();

     layouts.register("video", video, "Video");

     // ...

     layouts.showFiller(layouts.getRegistrationId(video, null, "videoUrl");

     

Expand
startTimer(displayObject:flash.display:DisplayObject, timerId:String) : void

Starts an event timer associated with a registered display object. Use this function for events that could be fired by multiple instances of the same type, in the case you need to differentiate the events fired by each instance.


     var imageMouseoverHandler:Function = function(event:MouseEvent):void {

       layouts.startTimer(event.target, "Hover Timer");

     };

     for each (var image:Sprite in images) {

       image.addEventListener(MouseEvent.MOUSE_OVER, imageMouseoverHandler);

     }

     

Expand
stopTimer(displayObject:flash.display:DisplayObject, timerId:String) : void

Stops an event timer associated with a registered display object. Use this function for events that could be fired by multiple instances of the same type, in the case you need to differentiate the events fired by each instance.


     var imageMouseoverHandler:Function = function(event:MouseEvent):void {

       layouts.stopTimer(event.target, "Hover Timer");

     };

     for each (var image:Sprite in images) {

       image.addEventListener(MouseEvent.MOUSE_OVER, imageMouseoverHandler);

     }

     

Expand
storeDetachedRoot(parent:flash.display:DisplayObject) : void

Store an unregistered parent object.

Expand
updateChildrenOfDetachedRoots(parent:flash.display:DisplayObject) : void

Resolves detached root and updates its children.

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