From September, Flash will no longer be supported by Chrome. Prepare for the shift towards HTML5 by visiting our Flash to HTML5 help page

Check it out!

Public Methods

Public methods are for assets:

  • dhtml.getVar(name, undefined_fallback) – returns string value of a banner variable with name (flashvars) or provided default value if variable does not exist. To get values of clickTAG and landingPageTarget variables from the system if variables are not present, use default expression:

    clickTAGvalue = dhtml.getVar('clickTAG', '');
    landingPageTarget = dhtml.getVar('landingPageTarget', '_blank');
  • dhtml.sendEvent(id, name, vars) – registers an event in the Adform system. If sending custom event id must be in the range from 1 to 19,  name argument is required and vars object is optional. vars object example: { bv1: 'John', bv2: 'Malcolm' }

    button.onclick = function() {
                    var id = 1,
                    name = 'banner click',
                    eventVars = {
                        bv1: "John",
                        bv2: "Colin",
                        bv3: "24"
                dhtml.sendEvent(id, name, eventVars);
                return false;
  • dhtml.getAsset(id) – returns URL of an asset with the given id, or 'undefined' if that asset does not exist. 

    var url = dhtml.getAsset(1); //A call to the function with the asset id.
  • dhtml.inscreen – use this object to track banner in-screen parameters from the asset.


    • on(type, callback) – adds an event listener.
    • once(type, callback) – adds an event listener and removes him after the event fires.
    • off(type, callback) – removes the event listener.


    • 'visible' – fires when banner's visible parameter changes.
    • 'percent' – fires when banner's percent parameter changes.
    • 'change' – fires when banner's any parameter changes.

    Every event (except 'change') passes value argument to its callback. This argument holds the latest value of banner's in-screen parameter.


    • visible (Boolean) – holds value whenever banner is visible or not (true or false).
    • percent (Number) – holds banner visibility percent value (from 0 to 100).

    Code examples:

        .on('visible', function (value) { console.log('visible change', value); })
        .on('percent', function (value) { console.log('percent change', value); })
        .on('change', function () {
          console.log('some change', {
            visible: this.visible,
            percent: this.percent
  • dhtml.external
    • expand() – expands banner from asset (used in expandable banner types)
    • close() – collapses or closes floating banner
    • superClose() – closes and destroys the entire banner
    • initPoliteMode() – announces that asset is ready to load heavy content (used with dhtml.sharedEvents.on('pageLoadComplete', listener))
    • updateBox(x, y, width, height) – used by Adform.SingleExpanding
    • expandComplete() – is used by Adform.SingleExpanding
    • collapseComplete() – is used by Adform.SingleExpanding
    • initScroll() – is used by Adform.FilmStrip
    • initSingleExpanding(x, y) – is used by Adform.SingleExpanding
    • toggleFullScreen(status) – is used by Adform.VideoPlayer

This method is for an interactive banner:

  • includeAPI() – a method that loads Adform.DHTML.js file from the appropriate Adform servers. All it does is just adds a document writing script, e.g.,
doc.write('<script src="'+fv.staticDomain + 'scripts/rmb/Adform.DHTML.js?bv='+'"><\/script>');