00:00
00:00
Newgrounds Background Image Theme

Chan99 just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

Newgrounds Api With Haxe

1,614 Views | 10 Replies
New Topic Respond to this Topic

Newgrounds Api With Haxe 2014-02-06 22:02:54


I'm making a game with Haxe and trying to use the Newgrounds API to show ads during the loading screen. Within Flash Develop everything seems to work fine, I load the game and I see the ad screen that says "Your Ad Code is Working". But when I load the .swf to newgrounds, all I see is an empty ad screen despite the fact that the connection works...

Connecting to the Newgrounds API Gateway...
----- Test -----
0 medals initialized.
Scoreboard: Levels Completed
Scoreboard: Total Score
2 scoreboards initialized.
0 save groups initialized.
Connection complete!

Has anyone else had this problem before. I'm not entirely sure that this is Haxe related at all, but you never know.

Response to Newgrounds Api With Haxe 2014-02-15 13:51:33


This was a very simple problem. I forgot to enable Flash Ads in the API Tools section of the project manager.

Response to Newgrounds Api With Haxe 2014-02-20 10:02:47


At 2/15/14 01:51 PM, Sebby64 wrote: This was a very simple problem. I forgot to enable Flash Ads in the API Tools section of the project manager.

hehe, that was an easy one.
I'm using the api with haxe too, and what I see is that the ads are only shown then the game is played on newgrounds. When the game runs on other portals (many copied the game from here), no ads are shown...
do you know if this is normal, or i'm missing something?

Response to Newgrounds Api With Haxe 2014-02-22 19:49:47


At 2/20/14 10:02 AM, Junjo wrote:
At 2/15/14 01:51 PM, Sebby64 wrote: This was a very simple problem. I forgot to enable Flash Ads in the API Tools section of the project manager.
hehe, that was an easy one.
I'm using the api with haxe too, and what I see is that the ads are only shown then the game is played on newgrounds. When the game runs on other portals (many copied the game from here), no ads are shown...
do you know if this is normal, or i'm missing something?

Hm that's not a problem for me. Are you doing any sort of site lock where the ad doesn't get created unless it's on newgrounds?

Response to Newgrounds Api With Haxe 2014-02-26 06:49:50


At 2/22/14 07:49 PM, Sebby64 wrote:
At 2/20/14 10:02 AM, Junjo wrote: I'm using the api with haxe too, and what I see is that the ads are only shown then the game is played on newgrounds. When the game runs on other portals (many copied the game from here), no ads are shown...
do you know if this is normal, or i'm missing something?
Hm that's not a problem for me. Are you doing any sort of site lock where the ad doesn't get created unless it's on newgrounds?

Really not. In fact, the ads component is shown (the black box with the NG logo) but no ads loads.

Response to Newgrounds Api With Haxe 2014-02-26 12:45:21


At 2/26/14 06:49 AM, Junjo wrote:
At 2/22/14 07:49 PM, Sebby64 wrote:
At 2/20/14 10:02 AM, Junjo wrote: I'm using the api with haxe too, and what I see is that the ads are only shown then the game is played on newgrounds. When the game runs on other portals (many copied the game from here), no ads are shown...
do you know if this is normal, or i'm missing something?
Hm that's not a problem for me. Are you doing any sort of site lock where the ad doesn't get created unless it's on newgrounds?
Really not. In fact, the ads component is shown (the black box with the NG logo) but no ads loads.

I'm not sure what your problem is. Have you tried uploading to another site (like a swf hosting site) and tried tracing when the API connects to see if it ever does?

Also here is my connecting code... not sure if this is useful to you since it looks just like the example code in the API wiki, but it's worth comparing against.

public function initNewgrounds()
{
	function onAPIConnected(event:APIEvent)
	{
		if(event.success)
		{
			trace("The API is connected and ready to use!");
			// Create ad here
		}
		else
		{
			trace("Error connecting to the API: " + event.error);
		}
	}
		
	API.addEventListener(APIEvent.API_CONNECTED, onAPIConnected);
	API.connect(Lib.current.root, "CODE", "CODE");
}

Response to Newgrounds Api With Haxe 2014-03-01 05:50:04


The code is almost the same, yes.
As you suggested, I'll put some traces and upload it to an external hosting to see what happens.
Thanks for your help.

Response to Newgrounds Api With Haxe 2014-05-01 14:52:02


At 2/6/14 10:02 PM, Sebby64 wrote: I'm making a game with Haxe and trying to use the Newgrounds API to show ads during the loading screen. Within Flash Develop everything seems to work fine, I load the game and I see the ad screen that says "Your Ad Code is Working". But when I load the .swf to newgrounds, all I see is an empty ad screen despite the fact that the connection works...

Connecting to the Newgrounds API Gateway...
----- Test -----
0 medals initialized.
Scoreboard: Levels Completed
Scoreboard: Total Score
2 scoreboards initialized.
0 save groups initialized.
Connection complete!

Has anyone else had this problem before. I'm not entirely sure that this is Haxe related at all, but you never know.

How did you link the SWC file to the Haxe Project? I'm having trouble getting it to work and there is very little information on how you can link SWC files to existing projects.

Response to Newgrounds Api With Haxe 2014-05-04 16:36:25


In your project.xml file you can put something like:

<haxeflag name="-swf-lib" value="Lib/NewgroundsAPI.swf" if="flash"/>

I used swf's, but swc should work similarly.

Response to Newgrounds Api With Haxe 2014-05-04 22:25:31


I did something very similar. I just dragged the swc file into my project and use this
<compilerflag name="-swf-lib NewgroundsAPI.swc"/> in my project.xml.

Response to Newgrounds Api With Haxe 2014-07-10 15:02:32


At 5/4/14 04:36 PM, Sebby64 wrote: In your project.xml file you can put something like:

<haxeflag name="-swf-lib" value="Lib/NewgroundsAPI.swf" if="flash"/>

I used swf's, but swc should work similarly.

That works! Thanks so much! :D