Section 1
//AdLoader (CPMStar.AdLoader)
package CPMStar {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public class AdLoader {
private static var cpmstarLoader:Loader;
public static function LoadAd(_arg1:int, _arg2:int):DisplayObject{
Security.allowDomain("server.cpmstar.com");
var _local3 = "http://server.cpmstar.com/adviewas3.swf";
cpmstarLoader = new Loader();
cpmstarLoader.load(new URLRequest(((((_local3 + "?poolid=") + _arg1) + "&subpoolid=") + _arg2)));
return (cpmstarLoader);
}
}
}//package CPMStar
Section 2
//button_8 (preroll_fla.button_8)
package preroll_fla {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.net.*;
import flash.system.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
import flash.ui.*;
import flash.utils.*;
public dynamic class button_8 extends MovieClip {
public function button_8(){
addFrameScript(0, frame1);
}
public function clickHandler(_arg1:Event):void{
parent.removeChild(parent["adBox"]);
parent.removeChild(this);
}
function frame1(){
addEventListener(MouseEvent.CLICK, clickHandler);
}
}
}//package preroll_fla
Section 3
//GoogleAd (GoogleAd)
package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.net.*;
import flash.system.*;
import flash.external.*;
import flash.utils.*;
public class GoogleAd extends MovieClip {
private var pubId:String;// = "ca-games-pub-1379420978573677"
private var DescriptionUrl:String;
private var pubtest:Boolean;
private var border:Number;
private var ani:Number;
private var my_txt:TextField;
private var _googleAds:Object;
private var my_mc:MovieClip;
private var wwidth:Number;
private var hheight:Number;
private var adwidth:Number;
private var adheight:Number;
private var Gender:Number;
private var Age:Number;
private var channel:Array;
private var contentId:String;
private var loader:Loader;
private var adScrollY:Number;
private var adMovieCached:MovieClip;
public var count;
public var adType:String;
public var adTime:Number;
public function GoogleAd(_arg1:MovieClip, _arg2:TextField, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Boolean, _arg8:Array):void{
this.wwidth = _arg3;
this.hheight = _arg4;
this.my_mc = _arg1;
this.my_txt = _arg2;
this.ani = _arg6;
this.channel = _arg8;
this.border = _arg5;
if (_arg7){
this.pubId = "ca-games-test";
};
addEventListener(Event.ADDED_TO_STAGE, this.addToStage);
}
private function addToStage(_arg1:Event):void{
removeEventListener(Event.ADDED_TO_STAGE, this.addToStage);
this.adwidth = 300;
this.adheight = 250;
this.Age = 1001;
this.adTime = 12;
this.count = 0;
this.contentId = "Game";
this.adType = "fullscreen";
this.DescriptionUrl = "http://media2.example.com/videos/78262.html";
this.doGoogleVideoAd();
}
public function doGoogleVideoAd():void{
Security.allowDomain("pagead2.googlesyndication.com");
var _local1:* = new URLRequest(("http://pagead2.googlesyndication.com/" + "pagead/scache/googlevideoadslibraryas3.swf"));
this.loader = new Loader();
this.loader.contentLoaderInfo.addEventListener(Event.COMPLETE, this.sendVideoAdRequest);
this.loader.load(_local1);
addChild(this.loader);
}
private function sendVideoAdRequest(_arg1:Event):void{
trace(("try to load" + this.adType));
this._googleAds = _arg1.target.content;
var _local2:* = this.makeRequest();
this._googleAds.requestAds(_local2, this.onVideoAdsRequestResult);
}
private function makeRequest():Object{
var _local1:* = new Object();
_local1.cust_gender = this.Gender;
_local1.cust_age = this.Age;
_local1.contentId = this.contentId;
_local1.publisherId = this.pubId;
_local1.pubWidth = this.adwidth;
_local1.pubHeight = this.adheight;
_local1.adType = this.adType;
_local1.descriptionUrl = this.DescriptionUrl;
_local1.channels = this.channel;
return (_local1);
}
private function scrollUp(_arg1:Event):void{
removeEventListener(Event.ENTER_FRAME, scrollUp);
}
private function scrollDown(_arg1:Event):void{
removeEventListener(Event.ENTER_FRAME, scrollUp);
}
private function onVideoAdsRequestResult(_arg1:Object):void{
var _local3:Number;
var _local4:Number;
var _local5:*;
var _local2:MovieClip;
if (_arg1.success){
_local2 = _arg1.ads[0].getAdPlayerMovieClip();
adMovieCached = _local2;
_local3 = 0.7;
_local4 = (this.hheight / this.wwidth);
if (_local3 < _local4){
_local5 = (350 * (_local4 - _local3));
_local2.setSize((500 - (this.border * 2)), ((350 - (this.border * 2)) + _local5));
_local2.setX(this.border);
_local2.setY((this.border - (_local5 / 2)));
};
if (_local3 > _local4){
_local5 = (500 * (_local3 - _local4));
_local2.setSize(((500 - (this.border * 2)) + _local5), (350 - (this.border * 2)));
_local2.setX((this.border - (_local5 / 2)));
_local2.setY(this.border);
};
if (_local3 == _local4){
_local2.setSize((500 - (this.border * 2)), (350 - (this.border * 2)));
_local2.setX(this.border);
_local2.setY(this.border);
};
dispatchEvent(new Event("haveAd"));
_local2.load();
_local2.onAdEvent = this.doOnAdEvent;
_local2.disableContentControls = this.toggleControls;
_local2.enableContentControls = this.toggleControls;
_local2.playAds();
dispatchEvent(new Event("gotad"));
if (this.adType != "video"){
setTimeout(this.timeDown, 100);
};
} else {
if (this.adType == "video"){
this.IfDontHaveVideo();
return;
};
closePubAnimation();
};
}
private function timeDown():void{
if (this.count < 100){
this.count++;
dispatchEvent(new Event("timetick"));
setTimeout(this.timeDown, 100);
} else {
closePubAnimation();
};
}
private function closePubAnimation():void{
dispatchEvent(new Event("finish"));
}
private function IfDontHaveVideo():void{
this.adType = "fullscreen";
var _local1:* = this.makeRequest();
this._googleAds.requestAds(_local1, this.onVideoAdsRequestResult);
}
private function toggleControls():void{
}
private function doOnAdEvent(_arg1:String):void{
if ((((this.adType == "video")) && ((_arg1 == "complete")))){
dispatchEvent(new Event("finish"));
};
}
}
}//package
Section 4
//Main (Main)
package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import CPMStar.*;
import flash.net.*;
import flash.system.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
import flash.ui.*;
import flash.utils.*;
public dynamic class Main extends MovieClip {
public var loadBar:MovieClip;
public var adBox:MovieClip;
public var debugoutput:TextField;
public var closeButton:MovieClip;
public var portalLogo:MovieClip;
public var _pub:String;
public var adLoaded;
public var _loc_2;
public var CPMStarPoolID:int;
public var CPMStarSubPoolID:int;
public var ad:DisplayObject;
public function Main(){
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
public function timeDown(_arg1:Event):void{
if (portalLogo.visible){
portalLogo.visible = false;
};
if (!loadBar.visible){
loadBar.visible = true;
};
loadBar.gotoAndStop(_arg1.target.count);
}
public function haveAd(_arg1:Event):void{
adLoaded = true;
}
public function finishAnimation(_arg1:Event):void{
if (adLoaded){
ExternalInterface.call("removeAdSwf()");
} else {
gotoAndStop(3);
};
}
public function timeCpmDown():void{
ExternalInterface.call("removeAdSwf()");
}
function frame1(){
play();
}
function frame2(){
_pub = "ca-games-pub-1379420978573677";
adLoaded = false;
_loc_2 = new GoogleAd(this, debugoutput, stage.stageWidth, stage.stageHeight, 10, 0, false, ["game"]);
_loc_2.addEventListener("gotad", this.haveAd);
_loc_2.addEventListener("timetick", this.timeDown);
_loc_2.addEventListener("finish", this.finishAnimation);
addChild(_loc_2);
loadBar.x = 10;
loadBar.width = stage.stageWidth;
loadBar.visible = false;
loadBar.stop();
stop();
}
function frame3(){
CPMStarPoolID = 5237;
CPMStarSubPoolID = 10101;
ad = AdLoader.LoadAd(CPMStarPoolID, CPMStarSubPoolID);
adBox.addChild(ad);
stop();
setTimeout(this.timeCpmDown, 10000);
}
}
}//package