Stencyl 3.4.0 is now out. Get it now!

CPMStar (Flash)

rob1221

  • *
  • Posts: 8913
I'm not updating this extension any more since I've lost interest in the Flash market.  If someone else wants to maintain the extension you can start a new thread and I'll lock this one.

Here is an extension that can show CPMStar interstitial ads.  You need a sponsor code before you can use any CPMStar ads though.  You can also add domains to either a whitelist or a blacklist so you can control what websites show these ads.

« Last Edit: December 18, 2016, 05:26:39 pm by rob1221 »

havana24

  • *
  • Posts: 467
Hi Rob,

This extension works on latest build of Stencyl?
Also, I saw that this extension was made basically after the DarkTimmy's problem with ArmorGames... I'm in the same position now.
This extension allow only interstitial, right?
What if I need a "Black list" on domain (Armorgames in my case) on the CPMstar preloader?

Thanks in advance,
Alessandro
My Website: www.havana24.net

rob1221

  • *
  • Posts: 8913
I don't see why the extension wouldn't still work since the Flash part of Stencyl is mostly unchanged.  If you need to add a blacklist to preloaders then you'll have to modify one of the preloader templates found here: http://www.stencyl.com/help/viewArticle/216

havana24

  • *
  • Posts: 467
Ok, could you give me a hand rob?  :-[

I open up the CPM star preloader with notepad++ and this is what I edit (red part).
Unfortunately I don't know haxe in order to get the domain and I'm not sure what to pass to startGame().

Quote
   
        .  .  .
   public function onEnterFrame(event:Event)
   {
      if(!started)
      {
         started = true;
         
                      if (server domain != "armorgames") {
                      #if flash
                      showCPM();
                      #end
                       } else {
                                     startGame(event:Event); // I don't know what to put in the ( )
                       }

      }
   }
   
   #if(flash && !air)
   private var ad:AdLoader;
   private var clickArea:nme.text.TextField;
   
   public function showCPM()
   {
      adFinished = false;
      
      var sWidth = stageWidth;
      var sHeight = stageHeight;
      
      clickArea = new nme.text.TextField();
      clickArea.selectable = false;
      clickArea.x = 0;
      clickArea.y = 0;
      clickArea.width = sWidth;
      clickArea.height = sHeight;
      
      addChild(clickArea);
      
      ad = new AdLoader(CPMStarID);
      ad.x = (sWidth / 2) - 150;
      ad.y = (sHeight / 2) - 150;
      addChild(ad);
      
      clickArea.addEventListener(MouseEvent.CLICK, startGame);
   }
   
   private function startGame(event:Event)
   {
      clickArea.removeEventListener(MouseEvent.CLICK, startGame);
      removeChild(ad);
      removeChild(clickArea);
      
      adFinished = true;
      dispatchEvent(new Event(Event.COMPLETE));
   }
   #end
My Website: www.havana24.net

rob1221

  • *
  • Posts: 8913
You can refer to the domain filtering code from the extension, and I believe the URL is flash.Lib.current.loaderInfo.url.

havana24

  • *
  • Posts: 467
OK thanks rob, I'll try!
And what I need to pass through the function  startGame(event:Event)?
My Website: www.havana24.net

rob1221

  • *
  • Posts: 8913
You can probably just put "event" in there.

havana24

  • *
  • Posts: 467
I don't know if this is the right place, but I have a problem with CPMstar default preloader.
I put on the right CPMstar id in settings, and I choose custom preloader -> CPMstar,  but from logs I see a warning:

Level:     WARN
When:      2014-11-02 23:59:30
From:      stencyl.sw.io.write.resource.HXWriter

You want a custom SWF preloader but did not provide a SWF.

Throwable: java.io.FileNotFoundException: Source '' does not exist
   at org.apache.commons.io.FileUtils.copyFile(FileUtils.java:1074)
   at org.apache.commons.io.FileUtils.copyFile(FileUtils.java:1038)
   at stencyl.sw.io.write.resource.HXWriter.write(HXWriter.java:1605)
   at stencyl.sw.io.write.resource.HXWriter.access$200(HXWriter.java:74)
   at stencyl.sw.io.write.resource.HXWriter$3.doInBackground(HXWriter.java:2372)
   at stencyl.sw.io.write.resource.HXWriter$3.doInBackground(HXWriter.java:2325)
   at javax.swing.SwingWorker$1.call(SwingWorker.java:277)
   at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
   at java.util.concurrent.FutureTask.run(FutureTask.java:138)
   at javax.swing.SwingWorker.run(SwingWorker.java:316)
   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
   at java.lang.Thread.run(Thread.java:695)

Also the game freeze with my default image-loader... After I press the mouse on it the game start.
Could you help me rob?

Thanks in advance,
-Alessandro
My Website: www.havana24.net

rob1221

  • *
  • Posts: 8913
I'm mostly clueless about toolset errors, so I can't help with that.

GameDev408

  • *
  • Posts: 208
Hi Rob,

I've done everything correctly but I still do not see CPMStar ads when I test the game.
I've attached some screenshots.

letmethink

  • *
  • Posts: 2516
I'm presuming the xxxxxx parts are where you have removed a valid code right?
~Letmethink

GameDev408

  • *
  • Posts: 208
I'm presuming the xxxxxx parts are where you have removed a valid code right?

Yes.

rob1221

  • *
  • Posts: 8913
I got an ad to show but not on the first test.  I'm not sure why that is and don't see anything I can do about it.

GameDev408

  • *
  • Posts: 208
I got an ad to show but not on the first test.  I'm not sure why that is and don't see anything I can do about it.

What do you mean?

rob1221

  • *
  • Posts: 8913
I tested the game once and an ad did not show.  I tested the game two more times and ads showed.