zoukankan      html  css  js  c++  java
  • Masthead广告类型帮助

    On close or exit, the masthead should:

    • Stop all video.

    • Stop all sounds.

    • Resolve the ad to the end-frame graphics.

    • Collapse, if the masthead is expanded.

    ------------------------------------------------------------>parent.fla

     1 enabler.addEventListener(StudioEvent.EXIT, onExitHandler);
     2 close_btn.addEventListener(YTCloseButton.CLOSE, closeHandler);
     3 expanded_mc.addEventListener("closeExpanded", onCloseExpandedHandler);
     4 
     5 function onCloseExpandedHandler(event:Event):void{
     6         Expanding.getInstance().collapse();
     7 }
     8 function closeHandler(event:Object):void{
     9        enabler.counter("Close Ad");
    10        YTPlayer.destroyAllVideos();
    11        SoundMixer.stopAll();
    12 }
    13 function onExitHandler(evt:StudioEvent){
    14         Expanding.getInstance().collapse();
    15 }

    ------------------------------------------------------------>child.fla

      1 enabler.addEventListener(StudioEvent.EXIT, exitClicked);
      2 close_expanded_mc.addEventListener(MouseEvent.CLICK, onCloseExpandedClicked);
      3 function exitClicked(e:StudioEvent)
      4 {
      5       YTPlayer.pauseAllVideos();// Pause all YouTube Videos
      6       stop();// Stop all animations
      7       SoundMixer.stopAll();// Stop all sounds
      8 }
      9 function onCloseExpandedClicked(evt:MouseEvent){
     10         YTPlayer.pauseAllVideos();// Pause all YouTube Videos
     11         SoundMixer.stopAll();// Stop all sounds
     12         MovieClip(parent).dispatchEvent(new Event("closeExpanded"));
     13         enabler.reportManualClose();
     14 }
     15 ////counters
     16 enabler.counter("Close Ad");
     17 enabler.counter("YTVideo Click to Play");
     18 enabler.counter("YTVideo Percent 0");
     19 enabler.counter("YTVideo Percent 25");
     20 enabler.counter("YTVideo Percent 50");
     21 enabler.counter("YTVideo Percent 75");
     22 enabler.counter("YTVideo Percent 100");
     23 enabler.counter("YTVideo Autoplay Percent 0");
     24 enabler.counter("YTVideo Autoplay Percent 25");
     25 enabler.counter("YTVideo Autoplay Percent 50");
     26 enabler.counter("YTVideo Autoplay Percent 75");
     27 enabler.counter("YTVideo Autoplay Percent 100");
     28 enabler.counter("YTVideo Pause");
     29 enabler.counter("YTVideo Replay");
     30 enabler.counter("YTVideo Mute");
     31 enabler.counter("YTVideo Unmute");
     32 enabler.counter("YTVideo Fullscreen Entered");
     33 enabler.counter("YTVideo Quality Change");
     34 /////////////////////
     35 
     36 import com.google.ads.studio.innovation.youtube.player.YTPlayerEvent;
     37 import flash.events.Event;import flash.events.MouseEvent;
     38 var videoShouldStop:Boolean = false;
     39 
     40 Security.allowDomain("s.ytimg.com");
     41 Security.allowDomain("s2.youtube.com");
     42 Security.allowDomain("i1.ytimg.com");
     43 Security.allowDomain("i2.ytimg.com");
     44 Security.allowDomain("i3.ytimg.com");
     45 Security.allowDomain("i4.ytimg.com");
     46 Security.allowDomain("www.youtube.com");
     47 Security.allowDomain("motifcdn2.doubleclick.net");
     48 
     49 ytVideo.proxy.addEventListener(YTPlayerEvent.VIDEO_QUALITY_CHANGE, eventHandler);
     50 function forceStop(e:Object) {
     51   trace("Stopping video");
     52   ytVideo.proxy.removeEventListener(YTPlayerEvent.VIDEO_PLAY, forceStop);
     53   ytVideo.proxy.removeEventListener(YTPlayerEvent.AUTOPLAY_VIDEO_0_PERCENT, forceStop);
     54   YTPlayer.pauseAllVideos();
     55   videoShouldStop = false;
     56 }
     57 function eventHandler(event:Object):void {
     58   // do not delete this
     59   if (videoShouldStop) {
     60     try {
     61       ytVideo.proxy.addEventListener(YTPlayerEvent.VIDEO_PLAY, forceStop);
     62       ytVideo.proxy.addEventListener(YTPlayerEvent.AUTOPLAY_VIDEO_0_PERCENT, forceStop);
     63     } catch (e) {
     64       // do nothing
     65     }
     66    }
     67     //trace(event.type);
     68    switch (event.type) {
     69     case YTPlayerEvent.PLAYER_READY :
     70       break;
     71     case YTPlayerEvent.VIDEO_PLAY:
     72       enabler.counter("YTVideo Click to Play");
     73        break;
     74     case YTPlayerEvent.VIDEO_COMPLETE:
     75       break;
     76     case YTPlayerEvent.VIDEO_0_PERCENT:
     77       enabler.counter("YTVideo Percent 0");
     78       break;
     79     case YTPlayerEvent.VIDEO_25_PERCENT:
     80       enabler.counter("YTVideo Percent 25");
     81       break;
     82     case YTPlayerEvent.VIDEO_50_PERCENT:
     83       enabler.counter("YTVideo Percent 50");
     84       break;
     85     case YTPlayerEvent.VIDEO_75_PERCENT:
     86       enabler.counter("YTVideo Percent 75");
     87       break;
     88     case YTPlayerEvent.VIDEO_100_PERCENT:
     89       enabler.counter("YTVideo Percent 100");
     90       break;
     91     case YTPlayerEvent.AUTOPLAY_VIDEO_0_PERCENT:
     92       enabler.counter("YTVideo Autoplay Percent 0");
     93       break;
     94     case YTPlayerEvent.AUTOPLAY_VIDEO_25_PERCENT:
     95       enabler.counter("YTVideo Autoplay Percent 25");
     96       break;
     97     case YTPlayerEvent.AUTOPLAY_VIDEO_50_PERCENT:
     98       enabler.counter("YTVideo Autoplay Percent 50");
     99       break;
    100     case YTPlayerEvent.AUTOPLAY_VIDEO_75_PERCENT:
    101       enabler.counter("YTVideo Autoplay Percent 75");
    102       break;
    103     case YTPlayerEvent.AUTOPLAY_VIDEO_100_PERCENT:
    104       enabler.counter("YTVideo Autoplay Percent 100");
    105       break;
    106     case YTPlayerEvent.VIDEO_PAUSE:
    107       enabler.counter("YTVideo Pause");
    108       break;
    109     case YTPlayerEvent.VIDEO_REPLAY:
    110       enabler.counter("YTVideo Replay");
    111       enabler.counter("YTVideo Mute");
    112       enabler.counter("YTVideo Unmute");
    113       enabler.counter("YTVideo Fullscreen Entered");
    114       enabler.counter("YTVideo Quality Change");
    115       break;
    116     case YTPlayerEvent.VIDEO_MUTE:
    117       enabler.counter("YTVideo Mute");
    118       break;
    119     case YTPlayerEvent.VIDEO_UNMUTE:
    120       enabler.counter("YTVideo Unmute");
    121       break;
    122     case YTPlayerEvent.VIDEO_FULLSCREEN:
    123       enabler.counter("YTVideo Fullscreen Entered");
    124       break;
    125     case YTPlayerEvent.VIDEO_EXIT_FULLSCREEN:
    126       break;
    127     case YTPlayerEvent.VIDEO_QUALITY_CHANGE:
    128       enabler.counter("YTVideo Quality Change");
    129       break;
    130   }
    131 }
    132  
    133 // YouTube video tracking event listeners
    134 ytVideo.proxy.addEventListener(YTPlayerEvent.PLAYER_READY, eventHandler);
    135 ytVideo.proxy.addEventListener(YTPlayerEvent.VIDEO_PLAY, eventHandler);
    136 ytVideo.proxy.addEventListener(YTPlayerEvent.VIDEO_COMPLETE, eventHandler);
    137 ytVideo.proxy.addEventListener(YTPlayerEvent.VIDEO_0_PERCENT, eventHandler);
    138 ytVideo.proxy.addEventListener(YTPlayerEvent.VIDEO_25_PERCENT, eventHandler);
    139 ytVideo.proxy.addEventListener(YTPlayerEvent.VIDEO_50_PERCENT, eventHandler);
    140 ytVideo.proxy.addEventListener(YTPlayerEvent.VIDEO_75_PERCENT, eventHandler);
    141 ytVideo.proxy.addEventListener(YTPlayerEvent.VIDEO_100_PERCENT, eventHandler);
    142 ytVideo.proxy.addEventListener(YTPlayerEvent.AUTOPLAY_VIDEO_0_PERCENT, eventHandler);
    143 ytVideo.proxy.addEventListener(YTPlayerEvent.AUTOPLAY_VIDEO_25_PERCENT, eventHandler);
    144 ytVideo.proxy.addEventListener(YTPlayerEvent.AUTOPLAY_VIDEO_50_PERCENT, eventHandler);
    145 ytVideo.proxy.addEventListener(YTPlayerEvent.AUTOPLAY_VIDEO_75_PERCENT, eventHandler);
    146 ytVideo.proxy.addEventListener(YTPlayerEvent.AUTOPLAY_VIDEO_100_PERCENT, eventHandler);
    147 ytVideo.proxy.addEventListener(YTPlayerEvent.VIDEO_PAUSE, eventHandler);
    148 ytVideo.proxy.addEventListener(YTPlayerEvent.VIDEO_REPLAY, eventHandler);
    149 ytVideo.proxy.addEventListener(YTPlayerEvent.VIDEO_MUTE, eventHandler);
    150 ytVideo.proxy.addEventListener(YTPlayerEvent.VIDEO_UNMUTE, eventHandler);
    151 ytVideo.proxy.addEventListener(YTPlayerEvent.VIDEO_FULLSCREEN, eventHandler);
    152 ytVideo.proxy.addEventListener(YTPlayerEvent.VIDEO_EXIT_FULLSCREEN, eventHandler);

    ================================

    需要加个fla 文件 名字为YTP_Billing_xStudio_fp9.fla

    =========================================

    YTPlayer.proxy  取得真正的youtube player,然后可以调用它的方法和属性。

    ===========================================

    1 YTPlayer.pause();
    2 YTPlayer.destroy();
    3 YTPlayer.play(); //(*Will not count woards youtube plays)
    4 YTPlayer.replay(); //(*Will not count woards youtube plays)
    5 YTPlayer.mute();
    6 YTPlayer.unmute();
    7 //============change the video dynamically to a new one by using the following methods:==============// 
    8 YTPlayer.cueVideoById("videoId"); 
    9 YTPlayer.loadVideoById("videoId"); ////(*Will not count woards youtube plays)
  • 相关阅读:
    转Oracle、MySql、SQLServer 数据分页查询
    转 DevExpress-ASPxPageControl 动态添加 TabPage 内容
    淘淘实惠多www.taohuiduo.com-专注独家折扣、1折特卖、9块9包邮、全场包邮
    "命名空间"system.web"中不存在类型或命名空间名称security"错误解决方法
    转摘 Eclipse智能提示及快捷键
    转(C#)Winform中MD5加密
    ComboBoxEdit数据绑定
    格式化日期和时间
    时间格式转换
    如何安装ESXi的补丁
  • 原文地址:https://www.cnblogs.com/1000pen/p/2741442.html
Copyright © 2011-2022 走看看