带有swiffy的已转换SWF上的退出URL [英] Exit URL on converted swf with swiffy

查看:102
本文介绍了带有swiffy的已转换SWF上的退出URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将DoubleClick Studio中的退出URL和指标从转换后的SWF文件中添加到HTML5文件中. 谁能告诉我最有效的方法是什么? HTML5广告素材中的代码是什么样的?在代码的最佳位置添加什么?使用什么标签? swiffy生成的代码对我来说就像一团糟.

I tried to add an exit URL and metrics from doubleclick studio from a converted swf with swiffy to the HTML5 file. Could anyone tell me what the most efficient way is to do this? What would the code look like in the HTML5 creative? Where in the code to add best? What tags to use? The code swiffy generates looks like a mess to me.

<!doctype html>
<html>
  <head>

   <script src="https://s0.2mdn.net/ads/studio/Enabler.js"> </script>
   <link rel="stylesheet" type="text/css" href="exit.css">
   <script src="exit.js"></script>


    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Swiffy Output</title>
    <script type="text/javascript" src="https://www.gstatic.com/swiffy/v7.3.0/runtime.js"></script>

    <script>
      swiffyobject = {"as3":true,"frameRate":25,"frameCount":342,"backgroundColor":-1,"frameSize":{"ymin":0,"xmin":0,"ymax":1800,"xmax":19400},"fileSize":52767,"v":"7.3.0","internedStrings":["::::::6Y:","::::: <<shortend from here>>

  </script>
    <style>html, body {width: 100%; height: 100%}</style>
  </head>
  <body style="margin: 0; overflow: hidden">

    <div id="swiffycontainer" style="width: 970px; height: 90px">
    </div>

    <script>

      var stage = new swiffy.Stage(document.getElementById('swiffycontainer'),
          swiffyobject, {});

      stage.start();
    </script>
  </body>
</html>

推荐答案

这是对因此,您的HTML5文件夹中将有一些文件(,您将这些文件打包成一个zip文件,以便在构建过程结束时将其上传到Doubleclick Studio )

So you will have a few files in your HTML5 folder ( that you'll package into a zip to upload to Doubleclick Studio at the end of the build process )

  • index.html
  • styles.css
  • backupimage(* .gif/* .jpg)
  • ajax-loader.gif(当元素仍在加载时,我将其用作占位符)
  • object.js(转换后的Swiffy代码将在其中)
  • script.js(魔术发生的地方 )
  • index.html
  • styles.css
  • backupimage ( *.gif / *.jpg )
  • ajax-loader.gif ( I use this as a placeholder when elements are still loading )
  • object.js ( where the converted Swiffy code will be )
  • script.js ( where the magic happens )

backupimage是您应该显示的图像,以防万一Creative不能加载,并且ajax-loader.gif可以在网上广泛使用.因此,我们将重点介绍其他4个文件.

The backupimage is the image you should show just in case the Creative doesn't load, and the ajax-loader.gif is available widely online. So we'll focus on the other 4 files.

index.html

<html lang="en-US">
    <head>
        <meta charset="UTF-8">
        <title>[ Creative Name ]</title>
        <meta name="ad.size" content="width=300,height=250">

        <link rel="stylesheet" type="text/css" href="styles.css" media="all">

        <script type="text/javascript" src="https://s0.2mdn.net/ads/studio/Enabler.js"></script>

        <!-- Make sure that this is the most recent runtime.js from the Swiffy Conversion file -->
        <script type="text/javascript" src="https://www.gstatic.com/swiffy/v7.3.0/runtime.js"></script>
        <script src="object.js"></script>
        <script src="script.js"></script>
    </head>

    <body>
        <div id="swiffycontainer" class="loading"></div>
        <div id="bg-exit"></div>
    </body>
</html>


styles.css

* {
    border:0;
    padding:0;
    margin:0;
}

body, html {
    width:100%;
    height:100%;
    overflow:hidden;
    background:#fff;

    width:100%;
    height:100%;

    position:relative;
}

#bg-exit {
    position:absolute;
    z-index:999999;
    left:0;
    top:0;
    width:100%;
    height:100%;
    overflow:hidden;
    cursor: pointer;
}

#swiffycontainer {
    position:absolute;
    z-index:100;
    width:100%;
    height:100%;
    overflow:hidden;
}

#swiffycontainer.loading {
    background: url("ajax-loader.gif") center center no-repeat;
}


objects.js

复制草率转换的所有输出,然后粘贴到{}中,如下所示

Copy whatever the output from the swiffy conversion and paste into the {} as shown below

var swiffyobject = {
"as3":false,"frameRate":24,"frameCount":114,"backgroundColor":-1,"frameSize":{" .... blah blah blah blah }]
};


scripts.js

var stage;
var clickTag;

if (!Enabler.isInitialized()) {
    Enabler.addEventListener(
        studio.events.StudioEvent.INIT,
        enablerInitialized
    );
} else {
    enablerInitialized();
}

function enablerInitialized() {
    if (!Enabler.isVisible()) {
        Enabler.addEventListener(
            studio.events.StudioEvent.VISIBLE,
            adVisible
        );
    } else {
        adVisible();
    }

}

function adVisible() {
    document.getElementById('swiffycontainer').className = "";
    document.getElementById('bg-exit').addEventListener('click', exitHandler, false);

    stage = new swiffy.Stage(document.getElementById('swiffycontainer'), swiffyobject, {});
    stage.start();
}

function exitHandler(e) {
    Enabler.exit('Exit');
}


为我完成上述工作,并且使用上述代码的所有广告素材均已获得Google质量检查的批准,并且正在被投放-因此,我对我的回答非常有信心-尽管这仍然是对此答案.

这篇关于带有swiffy的已转换SWF上的退出URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆