Banner build guide

Set up a polite load

What is polite loading?

Polite loading delays the loading of additional creative assets (like the child SWF) until the page has finished loading.

3-part polite load image: a) website partly loaded b) website fully loaded c) full ad appears including video

blue letter A Page 20% loaded: Parent file displays.

green letter b Page 50% loaded: Parent file displays.

red letter c Page 100% loaded: Child file displays.

DoubleClick Studio doesn't require that your files use polite load, but most sites do if they're loading a creative over 40K. This helps users avoid delays when visiting these sites.

When you use polite load, you can pause the timeline of your Flash movie, wait for the page to finish loading, and then control how the creative proceeds.

How do I set up a polite load?

There are two ways to set up polite load in Studio creatives: with the Loader component or using the API. We recommend that you use only one of these options.

Option 1: Loader component
The Loader component lets you manage a polite load without code. You drop the Loader onto the stage, specify a few settings in the Component Inspector, and additional content loads into the Loader component.

To use the component:

Setup section of Loader component inspector in Flash with the "Wait for page load to perform action" checkbox highlighted, labeled A, and the "Load movie" text field highlighted as well and labeled B. "Load movie..." is next to a radio button under the heading "Action to perform."
  1. Drag the component onto the stage on a new layer called Loader. Make sure to add the Loader component to a top layer so that the child SWF loads over the other content in your file.
    • To access this component, drag and drop it from the Component panel in Flash (shortcut: Ctrl+F7; Mac: command+F7).
  2. Edit the Component Inspector:

    Check Wait for page load to perform action.

    Under Action to perform, select Load movie... and enter the name of the child SWF in the text box.

  3. Position the Loader component where you want the child file to load. The component won't be visible in the published file, but the position of the Loader serves as the base axis (x:0, y:0) for the child SWF.
  4. When you test it in Flash, the unit waits a few seconds to simulate the polite load process, and then loads the child into the Loader component.
Option 2: API
This build guide is for AS3 users.  If you're using AS2, see AS2 Loader API.

The API lets you manage a polite load using only ActionScript.

Listen for the PAGE_LOADED event from the Enabler. Then load child content using our Studio Loader class. The example below waits for the page to load, then loads child.swf into a movie clip named "holderMC."


var enabler:HtmlEnabler = HtmlEnabler.getInstance();

var loadedHandler:Function = function(event:StudioEvent):void {
    var myLoader:StudioLoader = new StudioLoader();
    var req:URLRequest = new URLRequest("child.swf");
    //optional, if you want to listen for load completion:
    myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);

function loadComplete(event:Event):void{
  //child.swf has now loaded
enabler.addEventListener(StudioEvent.PAGE_LOADED, loadedHandler);

Try it!

Set up a polite load in your parent file by adding the Loader component or using the API.

Test your work

First publish all your child SWFs in Flash. Then, run the parent in Flash. The following traces should appear in the output panel:

    Enabler: Simulating page load
    Enabler: Page loaded


Was this article helpful?